phinx
phinx copied to clipboard
Migrate using target version causes warning invalid version on 32-bit systems
Different from the other issue of a similar name.
Attempting to run the command phinx migrate -t <version>
results in warning message warning 2147483647 is not a valid version
Given 2147483647 is the limit for integer, I'm assuming this is a 32-bit issue caused by:
Phinx\Console\Command\Migrate.php@120
if ($version) {
$version = (int)$version;
}
Commenting out the code listed above appears to work successfully.
Yeah, version should be treated as a float consistently throughout the system to avoid these issues. Given there's never any math involved, should not be affected by anything to do with rounding or whatever.
I tried to fix it by using floats where the version is used but the version is also used to index an array where the migrations are stored so that won't work either. Using normal strings worked fine everywhere. Maybe it's just time to upgrade my PHP setup to 64bit.
Oh wow, didn't realize there was an issue for this. Yeah, if we wanted to support 32bit PHP versions, I agree that we'd want to treat the version as a string, but then also modify the the data structures in Manager
and Environment
to not use it as an array index as that causes issues with how PHP automatically tries to cast numeric string keys to integers, and then trying to sort the array. For the few places we do sorting, could then just implicitly cast to float to compare, and we do that operation infrequently enough and you shouldn't have thousands of migrations that performance cost would be negligible.
The upside of using string based versions would be that we could probably look to better support alternative versioning schemes vs only supporting YYYYMMDDHHmmSS
type strings.
According to composer.json this package requires a 64bit PHP so I think this issue can be ignored as it should not be running in a 32bit environment.
Of topic: It seems that composer does not detect this 64bit requirement if Phinx is added as a sub-dependency. Is that something known or worth mentioning to the people at composer?
Being told that this conflict exists would have saved me quite some struggles.
Closing this as phinx now requires php64 when installing. If composer does not complain about this when installing phinx as a sub-dependency, I think this should be an issue made at composer's repo, as well as possibly modifying the upstream library to require php64 as well.