From: hans at nyphp dot com Operating system: Irrelevant PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Example of Exception $e is Incorrect
Description: ------------ On the page that gives examples of how to use Exceptions: http://www.php.net/manual/en/language.oop5.exceptions.php The usage of catch() is incorrect in the examples. This code: catch (Exception $e) { echo "Caught exception: ", $e, "\n"; } Would echo something like: Caught exception: Object id #3 I cannot believe this is the desired output. This code: catch (Exception $e) { echo "Caught exception: ", $e->getMessage(), "\n"; } Would provide the expected output: Caught exception: Always throw this error In other words, all exception code examples with echo statements of $e should contain $e->getMessage() rather than just echoing $e. Hans -- Edit bug report at http://bugs.php.net/?id=30379&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30379&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30379&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30379&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=30379&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=30379&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=30379&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=30379&r=needscript Try newer version: http://bugs.php.net/fix.php?id=30379&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=30379&r=support Expected behavior: http://bugs.php.net/fix.php?id=30379&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=30379&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=30379&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=30379&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30379&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=30379&r=dst IIS Stability: http://bugs.php.net/fix.php?id=30379&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=30379&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=30379&r=float MySQL Configuration Error: http://bugs.php.net/fix.php?id=30379&r=mysqlcfg