php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24413 exception example provided on php site fails
Submitted: 2003-06-30 11:34 UTC Modified: 2003-07-03 07:04 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: tleake at ebuyer dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.0b1 (beta1) OS: mandrake linux 9.0
Private report: No CVE-ID: None
 [2003-06-30 11:34 UTC] tleake at ebuyer dot com
Description:
------------
Trying the code below from the php site fails with the following error. This is php-5.0.0 beta1 compiled with --disable-all under linux


Call to undefined method exception::__construct()

Reproduce code:
---------------
<?php
class MyExceptionFoo extends Exception {
    function __construct($exception) {
        parent::__construct($exception);
    }
}

try {
    throw new MyExceptionFoo("Hello");
} catch (MyException $exception) {
    print $exception->getMessage();
}
?> 

Expected result:
----------------
hello

Actual result:
--------------
<br />
<b>Fatal error</b>:  Call to undefined method exception::__construct() in <b>/home/tony/software/web/php-5.0.0b1/sapi/cgi/test.php</b> on line <b>4</b><br />

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-03 05:01 UTC] stas@php.net
Could you please point out where is this code on the site?
 [2003-07-03 05:15 UTC] tleake at ebuyer dot com
Sure its http://www.php.net/zend-engine-2.php in the section exceptions
 [2003-07-03 07:04 UTC] stas@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Should work now (except for MyException should be MyExceptionFoo in the catch). 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Aug 19 05:01:29 2024 UTC