#49402 [Opn->Csd]: Documentation for extending Exception is outdated
| From: | rquadling@php.net | Date: | Tue, 01 Sep 2009 10:21:15 +0000 |
| Subject: | #49402 [Opn->Csd]: Documentation for extending Exception is outdated | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2703@lists.php.net to get a copy of this message | ||
ID: 49402
Updated by: rquadling@php.net
Reported By: juwe at clasennet dot de
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: *
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2009-09-01 10:20:57] svn@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=287937
Log: Missing properties and methods of the built-in Exception class and
note regarding the inability to clone an Exception.
Fixes bug #49402
------------------------------------------------------------------------
[2009-08-28 20:26:02] juwe at clasennet dot de
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 this bug report at http://bugs.php.net/?id=49402&edit=1