-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/bcmath: Fixed LONG_MAX #15663
New issue
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
ext/bcmath: Fixed LONG_MAX #15663
Conversation
It's doubtful to define it this way, since on LP64 architectures (which are likely used by most PHP builds) Given that |
Here is the definition in php.h. Line 229 in e12188f
I don't know why it's defined as 32bit.... |
Perhaps because nobody cared about it since 64bit support happened. |
oh... In fact, if want a 64-bit value, use It seems difficult to immediately switch |
Note that this is only when LONG_MAX is not defined in limits.h, which it should be in C99. LONG_MAX is only used in bcmath here: php-src/ext/bcmath/libbcmath/src/num2long.c Lines 48 to 55 in 58aa6fc
Just include php.h for the correct definition in the C file (if it's not already included indirectly), and remove the wrong definition from the header. |
We cannot do this at all, because it would be wrong.
The intention of using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good as is for now (we can revisit this for PHP 8.5 or PHP 9.0).
Thank you for the PR!
Ah, I see, I remembered incorrectly about |
@cmb69 limits.h is included too, so the fallback doesn't matter and the value will be right. |
@nielsdos, there is no problem as it is now. bcmath.h includes zend.h which includes zend_types.h which includes zend_portability.h which includes limits.h. (Well, no problem regarding the possibly missing <limits.h> inclusion, but apparently a big mess regarding the inlcudes; maybe worse: php_bcmath.h includes bcmath.h which in turn includes php_bcmath.h.) |
Right, then ig we can just drop these fallbacks in the next version. |
One
f
is missing.However,
LONG_MAX
is predefined in php.h, so this macro will probably never be used....TBH, I think it's okay to delete it...