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

Bug #18218 "pear package" does not allow the use of late static binding
Submitted: 2011-01-25 03:47 UTC
From: christer Assigned: dufuz
Status: Closed Package: PEAR (version 1.9.1)
PHP Version: 5.3.1 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2011-01-25 03:47 UTC] christer (Christer Edvartsen)
Description: ------------ The bug has been previously reported (#17652) but was marked as bogus. I added a comment and a patch to that bug report, but will add them again here. Test script: --------------- class Autoload { static public $classes = array( // ... ); static public function load($class) { $className = strtolower($class); if (isset(static::$classes[$className])) { require dirname(__DIR__) . static::$classes[$className]; } } } Expected result: ---------------- No errors Actual result: -------------- If something like the above code is in a PHP script when trying to build a package pear will inform you that the file has invalid php code. The reason is that the Validator.php class only allows T_WHITESPACE and T_STRING in front of the T_DOUBLE_COLON. If you change the source to "self::$classes" instead of "static::$classes" pear does not complain.

Comments

 [2011-01-25 03:48 UTC] christer (Christer Edvartsen)
 [2011-02-20 09:46 UTC] doconnor (Daniel O'Connor)
-Assigned To: +Assigned To: saltybeagle
 [2011-02-20 23:31 UTC] saltybeagle (Brett Bieber)
-Status: Assigned +Status: Open
I don't maintain PEAR
 [2011-02-27 21:21 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Assigned To: +Assigned To: dufuz
 [2011-02-27 23:42 UTC] dufuz (Helgi Þormar Þorbjörnsson)
Can you provide me with exactly the code (a stripped down version is fine). I can run the code below through the source analyzes function just fine without any errors being raised.
 [2011-02-28 00:08 UTC] christer (Christer Edvartsen)
You can clone a repos of mine from github and run pear package in that dir to get the error: christer@aurora:~$ git clone git://github.com/christeredvartsen/sqldiff.git ... christer@aurora:~$ cd sqldiff/ christer@aurora:~/sqldiff$ pear package Analyzing SqlDiff/Database/Table/Column/Abstract.php ... Warning: Parser error: invalid PHP found in file "./SqlDiff/Version.php" Warning: Parser error: invalid PHP found in file "./SqlDiff/Autoload.php" I'm getting the Parser error above with PEAR-1.9.1. After applying my patch I'm not getting any warnings.
 [2011-02-28 00:42 UTC] dufuz (Helgi Þormar Þorbjörnsson)
Interesting, can not get the check function to fail on that code; Will have to test it via packaging up the code.
 [2011-02-28 01:01 UTC] dufuz (Helgi Þormar Þorbjörnsson)
-Status: Assigned +Status: Closed
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Found the issue, test framework was acting up