We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following code:
<?php class MyString { function __toString() { return "2"; } } $a = new BCMath\Number("1"); $b = new MyString(); var_dump($a + $b, $b);
Resulted in this output:
object(BcMath\Number)#2 (2) { ["value"]=> string(1) "3" ["scale"]=> int(0) } string(1) "2"
But I expected this output instead:
object(BcMath\Number)#2 (2) { ["value"]=> string(1) "3" ["scale"]=> int(0) } object(MyString)#2 (0) { }
Note that this even happens in strict typing mode, where it may not even be expected that the addition succeeds.
Anyhow, the problem is that zend_parse_arg_str_or_long_slow() converts the passed arg.
zend_parse_arg_str_or_long_slow()
arg
Also note that GMP also uses ZPP functionality, but catches any such type conversion, even in coercive typing mode.
PHP 8.4
any
The text was updated successfully, but these errors were encountered:
Confirmed: https://3v4l.org/6g9B3/rfc#vgit.master
Somewhat different issue, but also related to bcmath_number_parse_num():
bcmath_number_parse_num()
<?php declare(strict_types=0); var_dump(new BCMath\Number("1") + null);
does not throw a deprecation warning, as it is supposed to, since the RFC states:
Calculations with the operator behave as if the corresponding method's optional arguments were not specified.
And for strict typing, the operation succeeds, but the method fails.
Sorry, something went wrong.
/cc @SakiTakamachi
No branches or pull requests
Description
The following code:
Resulted in this output:
But I expected this output instead:
Note that this even happens in strict typing mode, where it may not even be expected that the addition succeeds.
Anyhow, the problem is that
zend_parse_arg_str_or_long_slow()
converts the passedarg
.Also note that GMP also uses ZPP functionality, but catches any such type conversion, even in coercive typing mode.
PHP Version
PHP 8.4
Operating System
any
The text was updated successfully, but these errors were encountered: