Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.9.0

Request #6056 Add support for reporting max PHP version
Submitted: 2005-11-24 11:35 UTC
From: giunta dot gaetano at sea-aeroportimilano dot it Assigned: farell
Status: Closed Package: PHP_CompatInfo
PHP Version: 4.4.1 OS: irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2005-11-24 11:35 UTC] giunta dot gaetano at sea-aeroportimilano dot it
Description: ------------ Hi there. I added support for a 'max supported php version' to the script. It is added as new key ('max_version') to the fileinfo array. The patched version of the script is below, copy'n'pasted. To actually have the script emit anyting, the func_array and const_array must be augmented, adding an 'end' key indicating the maximum php version that supports a feature. If the key is absent from the data arrays, the script assumes max version is infinite, i.e. no warning will be emitted when running with current data arrays. The only function that has been removed, off the top of my head is php_check_syntax (PHP 5 <= 5.0.4), but there might be others... NB: future updates I might post: adding a 'supported os + webserver' calculating routine, based on the used extensions; analysis of parameter count for functions, so that functions that got parameters added in later releases can be detected; analysis of usage of 'include/require', 'eval' and similar constructs, so that user can be informed in those cases about the analysis not being accurate. Test script: --------------- Diff to CompatInfo.php,v 1.15 59,64d58 < /** < * @var string Last version of PHP to use < */ < < var $earliest_version = ''; < 152,153d145 < $earliest_version = $this->earliest_version; < 188,191d179 < if ($file['max_version'] != '') { < if ($earliest_version = '' || 1 === version_compare($earliest_version, $file['max_version'])) < $earliest_version = $file['max_version']; < } 211d198 < $files['max_version'] = $earliest_version; 261d247 < $earliest_version = $this->earliest_version; 295,298d280 < if ($file['max_version'] != '') { < if ($earliest_version = '' || 1 === version_compare($earliest_version, $file['max_version'])) < $earliest_version = $file['max_version']; < } 315d296 < $files_parsed['max_version'] = $earliest_version; 338d318 < $earliest_version = $this->earliest_version; 411,415d390 < if (array_key_exists('end', $GLOBALS['funcs'][$name])) { < if ($earliest_version == '' || 1 === version_compare($earliest_version,$GLOBALS['funcs'][$name]['end'])) { < $earliest_version = $GLOBALS['funcs'][$name]['init']; < } < } 438,442d412 < if (array_key_exists('end', $GLOBALS['const'][$constant])) { < if ($earliest_version == '' || 1 === version_compare($earliest_version,$GLOBALS['const'][$constant]['end'])) { < $earliest_version = $GLOBALS['funcs'][$name]['init']; < } < } 453d422 < $functions_version['max_version'] = $earliest_version; 519d487 <

Comments

 [2006-06-17 07:53 UTC] farell (Laurent Laville)
Hi, Can you tell me what situation requires a max_version, in your opinion ? Thanks in advance for reply Laurent
 [2006-06-19 07:47 UTC] giunta dot gaetano at sea-aeroportimilano dot it
There is a lot of stuff that changed between php 4 and php 5... As an example, in PHP 5 the charset param used for creation of an xml parser has been deprecated. The same applies for the 'var' keyword...
 [2006-06-27 22:26 UTC] farell (Laurent Laville)
i've finally implemented your request on latest version into PEAR CVS. Could you have a look and tell me if it's ok for you ? Laurent See especially test script http://cvs.php.net/viewvc.cgi/pear/PHP_CompatInfo/tests/checkMax.php?revision=1.1&view=markup that demonstrates ambiguity that is possible
 [2006-06-28 14:59 UTC] giunta dot gaetano at sea-aeroportimilano dot it
I did not really check the source code, but the end results look fine to me (at least when parsing the test file you provided). What do you exactly mean by "ambiguity that is possible" ?
 [2006-06-28 17:35 UTC] farell (Laurent Laville)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/PHP_CompatInfo I mean by "ambiguity that is possible" , results such as given by test script example. versions : PHP min > php max But we have just to take care like i did with test script and a version_compare. This request is now closed and will be include in next release 1.1.0