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

Bug #11942 setData creates an error even when it isn't raised
Submitted: 2007-08-30 14:25 UTC
From: knipil Assigned: jmcastagnetto
Status: Closed Package: Math_Matrix (version 0.8.0)
PHP Version: 5.1.6 OS: Gentoo
Roadmaps: (Not assigned)    
Subscription  


 [2007-08-30 14:25 UTC] knipil (Emil Hernvall)
Description: ------------ In the setData method PEAR::raiseError is called even if an error doesn't occur. When a lot of matrix objects are instantiated (in my case during image analysis) theese objects stay in memory and causes php to run out of ram. This is easily corrected by changing: $errorObj = PEAR::raiseError('Invalid data, cannot create/modify matrix'); if (!is_array($data) || !is_array($data[0])) { return $errorObj; } To: if (!is_array($data) || !is_array($data[0])) { $errorObj = PEAR::raiseError('Invalid data, cannot create/modify matrix'); return $errorObj; } Test script: --------------- <?php require 'Math/Matrix.php'; for ($i = 0; $i < 1000000; $i++) { $m = new Math_Matrix(array(array(1))); }

Comments

 [2007-11-19 07:07 UTC] jmcastagnetto (Jesus M. Castagnetto)
This bug has been fixed in CVS. 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.