Skip to content

Change BIGINT native PHP type back to int #2029

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

db-mobile
Copy link

Originally BIGINT was mapped to PHP native type int back in 2005. This was changed to string in revision 56f6a84.

Apparently 32-bit PHP types were incapable of storing the full range of BIGINT without running out of bounds. This should not be an issue in times of 64 bit and the minimum required version of PHP being 7.4 for Propel2.

This solution however preserves the old behavior on 32 bit systems.

@PhilinTv
Copy link
Contributor

@db-mobile it's a good idea!

But there is a BC-break to the current 64x systems: they currently run strings and will get inconsistent BIGINT definition.
If you agree, it's a major change, could you please provide an optional enablement (BC) of the correct BIGINT?

@hsegnitz
Copy link
Contributor

hsegnitz commented May 5, 2025

Ahoi,

if I'm not mistaken, PHP_INT_MAX on 64bit is 63bit + 1bit for the sign.
At least with MySQL "BIGINT UNSIGNED" uses that extra bit to extend the range upwards to allow numbers up to (2x PHP_INT_MAX) +1.
That means it would still be out of bounds for PHP as PHP Integers are always signed. I guess they would be cast to float then and lose precision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants