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

Request #17524 Use static keyword for static methods
Submitted: 2010-06-26 23:42 UTC
From: bindzus Assigned:
Status: Open Package: Calendar (version 0.5.5)
PHP Version: 5.3.2 OS: Windows Vista
Roadmaps: (Not assigned)    
Subscription  


 [2010-06-26 23:42 UTC] bindzus (Thomas Bindzus)
Description: ------------ Running the first example given in the documentation generates a lot of Strict Standards errors: Strict Standards: Non-static method Calendar_Engine_Factory::getEngine() should not be called statically, assuming $this from incompatible context in C:\src\web applications\php\common\libs\pear\PEAR\Calendar\Calen dar.php on line 211 Test script: --------------- <?php require_once 'Calendar/Month.php'; require_once 'Calendar/Month/Weekdays.php'; $Month = new Calendar_Month(2003, 10); // October 2003 $Month->build(); // Build the days in the month // Loop through the days... while ($Day = $Month->fetch()) { echo $Day->thisDay().'<br />'; } $Month = new Calendar_Month_Weekdays(date('Y'), date('n')); $Month->build(); ?> Expected result: ---------------- When running the script above I expect to see the dates for October 2003 listed one date per line. Actual result: -------------- I do see the dates but I also get a lot of Strict Standards errors because of my error report settings in php.ini: error_reporting = E_ALL | E_STRICT So I have added static to the method getEngine declared in the class Calendar_Engine_Factory. I hope that future versions of the Calendar package will include the keyword static on static methods, so I can keep my php.ini and also so I do not have to modify the package after upgrading.

Comments

 [2011-10-27 14:55 UTC] nahuel (Nahuel Angelinetti)
The patch seems to work correctly, please publish a new release of PEAR::Calendar with this one.