| Summary: | PHP version info given in gentoo makes comparisons of versions fail | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Arnaud Limbourg <arnaud> |
| Component: | New packages | Assignee: | PHP Bugs <php-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | High | ||
| Version: | 2006.0 | ||
| Hardware: | All | ||
| OS: | Other | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
How did this bug make it back, been already fixed once. Yeah, it needs -pl? there. This would work: 5.1.2-p-gentoo (In reply to comment #2) > This would work: 5.1.2-p-gentoo Yeah, it would, but it looks hell ugly. :P I prefer 5.1.2-pl1-gentoo :) It works too :)
php -r "var_dump(version_compare('5.1.2', '5.1.2-pl1-gentoo'));"
int(-1)
Ok, the -rX ebuilds are marked as VER-plX-gentoo, so those work, the problem is the zero revision (-r0) that's implicit, which gets VER-gentoo, and version_compare fails... I'll fix it so that a normal dev-lang/php-5.1.2 emerge will give you 5.1.2-pl0-gentoo, dev-lang/php-5.1.2-r1 will be 5.1.2-pl1-gentoo, and so on. Best regards, CHTEKK. Fixed now in CVS, done as I've stated in the previous comment. Best regards, CHTEKK. |
Because php version info in gentoo has the form X.x.x-gentoo, comparisons done using version_compare() fail. An example is when trying to install a pear package that requires a given php version: pear/PHPUnit2 requires PHP (version >= 5.1.2, version <= 6.0.0), installed version is 5.1.2-gentoo # php -r "var_dump(version_compare('5.1.2', '5.1.2-gentoo'));" int(1) The solution is to modify the suffix to use either a numerical suffix or a patch level suffix # php -r "var_dump(version_compare('5.1.2', '5.1.2-1'));" int(-1) # php -r "var_dump(version_compare('5.1.2', '5.1.2-p-gentoo'));" int(-1) The -1 means the right version is higher than the left one. For more explanation please see http://en.php.net/manual/en/function.version-compare.php