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

Bug #10780 wrong output from PEAR_Exception
Submitted: 2007-04-19 18:35 UTC
From: cwiedmann Assigned: cellog
Status: Closed Package: PEAR (version 1.5.2)
PHP Version: 5.2.1 OS: Windows_NT
Roadmaps: (Not assigned)    
Subscription  


 [2007-04-19 18:35 UTC] cwiedmann (Carsten Wiedmann)
Description: ------------ If I use a PEAR_Error object as second parameter for PEAR_Exception, I get a wrong output. If I execute the testscript in the shell, the wrong output is different to the wrong output when I access the script with a webbrowser. Test script: --------------- <?php error_reporting(E_ALL); require_once 'MDB2.php'; require_once 'PEAR/Exception.php'; class foo { public static function bar() { $dsn = 'mysql://user@host/database'; $mdb2 = MDB2::connect($dsn); if (PEAR::isError($mdb2)) { throw new PEAR_Exception($mdb2->getMessage(), $mdb2); } } } foo::bar(); ?> Actual result: -------------- *** [in shell with PHP CLI] *** Notice: Undefined index: file in C:\php\pear\PEAR\Exception.php on line 386 Notice: Undefined index: line in C:\\php\pear\PEAR\Exception.php on line 387 Fatal error: Uncaught PEAR_Exception: MDB2 Error: connect failed in C:\test-db.php on line 17 MDB2_Error: MDB2 Error: connect failed in on line #0 C:\test-db.php(17): foo::bar() #1 {main} thrown in C:\test-db.php on line 12 *** [in Browser with PHP Apache2Handler] *** Notice: Undefined index: file in C:\php\pear\PEAR\Exception.php on line 334 Notice: Undefined index: line in C:\php\pear\PEAR\Exception.php on line 335 Fatal error: Uncaught <table border="1" cellspacing="0"> <tr><td colspan="3" bgcolor="#ff9999"> <b>PEAR_Exception</b>: MDB2 Error: connect failed in <b>C:\test-db.php</b> on line <b>17</b></td></tr> <tr><td colspan="3" bgcolor="#ff9999">- <b>MDB2_Error</b>: MDB2 Error: connect failed in <b></b> on line <b></b></td></tr> <tr><td colspan="3" bgcolor="#aaaaaa" align="center"><b>Exception trace</b></td></tr> <tr><td align="center" bgcolor="#cccccc" width="20"><b>#</b></td><td align="center" bgcolor="#cccccc"><b>Function</b></td><td align="center" bgcolor="#cccccc"><b>Location</b></td></tr> <tr><td align="center">0</td><td>foo::bar()</td><td>C:\test-db.php:17</td></tr> <tr><td align="center">1</td><td>{main}</td><td> </td></tr> </table> thrown in C:\test-db.php on line 12

Comments

 [2007-05-06 23:08 UTC] cellog (Greg Beaver)
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.