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

Bug #16529 Doesn't work with PHP 5.3.0
Submitted: 2009-08-17 01:15 UTC
From: alexey_baturin Assigned: neufeind
Status: Closed Package: Image_Graph (version 0.7.2)
PHP Version: 5.3.0 OS: Windows XP SP3
Roadmaps: (Not assigned)    
Subscription  


 [2009-08-17 01:15 UTC] alexey_baturin (Alexey Baturin)
Description: ------------ It seems that Image_Graph doesn't work with PHP 5.3.0 The problem is php changed behavior of default constructors in class inheritance. The example code illustrating the source of the problem - works well with php 5.1.6 and 5.2.4, but falls with a fatal error in php 5.3.0: <?php class A { function A() { } } class B extends A { } class C extends B { function C() { parent::B(); } } new C(); ?> Temporary solution is to create explicit default constructors for all classes that need them. Test script: --------------- <?php // actually any script from examples error_reporting(E_ALL); include 'Image/Graph.php'; $Graph =& Image_Graph::factory('graph', array(400, 300)); $Plotarea =& $Graph->addNew('plotarea'); $Dataset =& Image_Graph::factory('dataset'); $Dataset->addPoint('Denmark', 10); $Dataset->addPoint('Norway', 3); $Dataset->addPoint('Sweden', 8); $Dataset->addPoint('Finland', 5); $Plot =& $Plotarea->addNew('bar', &$Dataset); $Graph->done(); ?> Expected result: ---------------- Some graph Actual result: -------------- Fatal error: Call to undefined method Image_Graph_Element::Image_Graph_Element() in C:\Program Files\PHP\pear\Image\Graph.php on line 136

Comments

 [2009-10-31 08:19 UTC] kolesm (Mihaly Koles)
A simple solution (workaround): Change every parent::Image_* to this: parent::__construct()
 [2009-11-23 05:41 UTC] neufeind (Stefan Neufeind)
-Status: Open +Status: Closed -Assigned To: +Assigned To: neufeind
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. Decided to go for parent::__construct(). Thank you for the suggestion. This means that package will now also move on to PHP 5.x ...
 [2010-01-21 22:07 UTC] aladin (Aladin Quet)
I also confirm that the solution/workaround works. But I didn't found which svn contains the patch?