Doc #63125 [NEW]: Wrong Example of Class ErrorException

From: Date: Fri, 21 Sep 2012 05:50:28 +0000
Subject: Doc #63125 [NEW]: Wrong Example of Class ErrorException
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8867@lists.php.net to get a copy of this message
From: xianrenb at gmail dot com Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:Wrong Example of Class ErrorException Description: ------------ --- From manual page: http://www.php.net/class.errorexception --- I believe the example in the manual page as at Sep 21, 2012 is wrong: 1. According to the manual page of set_error_handler(), $errno contains the level of the error raised, as an integer. This is the same meaning as $severity of class ErrorException. 2. Class ErrorException has property $severity, but class Exception does not have the same property. It only makes sense if $severity is set to something useful (non-zero), and related to error. 3. $severity has a default value of 1, which is the same value as E_ERROR, while $code has a default value of 0. 4. Most notes contributed by other PHP users, if not all, use ErrorException in the same way as in the expected result suggested. Expected result: ---------------- Example documented as: <?php function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } set_error_handler("exception_error_handler"); /* Trigger exception */ strpos(); ?> Actual result: -------------- Example documented as: <?php function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr, $errno, 0, $errfile, $errline); } set_error_handler("exception_error_handler"); /* Trigger exception */ strpos(); ?> -- Edit bug report at https://bugs.php.net/bug.php?id=63125&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63125&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63125&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63125&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63125&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63125&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63125&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63125&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63125&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63125&r=support Expected behavior: https://bugs.php.net/fix.php?id=63125&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63125&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63125&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63125&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63125&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63125&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63125&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63125&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63125&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63125&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63125&r=mysqlcfg

« previous php.doc.bugs (#8867) next »