#49402 [NEW]: Documentation for extending Exception is outdated

From: Date: Fri, 28 Aug 2009 20:26:02 +0000
Subject: #49402 [NEW]: Documentation for extending Exception is outdated
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2682@lists.php.net to get a copy of this message
From: juwe at clasennet dot de Operating system: irrelevant PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Documentation for extending Exception is outdated Description: ------------ The documentation about extending exceptions (http://www.php.net/manual/en/language.exceptions.extending.php) describes an outdated version of the Exception class. The page says, the build-in Exception class would have this interface: <?php class Exception { protected $message = 'Unknown exception'; // exception message protected $code = 0; // user defined exception code protected $file; // source filename of exception protected $line; // source line of exception function __construct($message = null, $code = 0); final function getMessage(); // message of exception final function getCode(); // code of exception final function getFile(); // source filename final function getLine(); // source line final function getTrace(); // an array of the backtrace() final function getTraceAsString(); // formatted string of trace /* Overrideable */ function __toString(); // formatted string for display } ?> This is not true any longer. Suggested fix: Replace Example #1 with this code: <?php class Exception { /* Properties */ protected string $message ; private string $string ; protected int $code ; protected string $file ; protected int $line ; private array $trace ; /* Methods */ public __construct ($message = "",$code = 0, Exception $previous = NULL ) ; final public string getMessage ( ) ; final public Exception getPrevious ( ) ; final public int getCode ( ) ; final public string getFile ( ) ; final public int getLine ( ) ; final public array getTrace ( ) ; final public string getTraceAsString ( ) ; public string __toString ( ) ; final private void __clone ( ) ; } ?> Additionally, the second example is missing a parameter for the constructor. Reproduce code: --------------- none Expected result: ---------------- none, since there's no code. Actual result: -------------- ??? -- Edit bug report at http://bugs.php.net/?id=49402&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49402&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49402&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49402&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49402&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49402&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49402&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49402&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49402&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49402&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49402&r=support Expected behavior: http://bugs.php.net/fix.php?id=49402&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49402&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49402&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49402&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49402&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49402&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49402&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49402&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49402&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49402&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49402&r=mysqlcfg

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