|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38624 Strange warning when throwing an exception from a __set method.
Submitted: 2006-08-28 09:59 UTC Modified: 2006-08-28 10:26 UTC
From: Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2006-08-28 (CVS) OS: *
Private report: No CVE-ID:
 [2006-08-28 09:59 UTC]
When throwing an exception from a __set() method a strange fatal error is shown. I would expect to see the uncaught exception error. Even if I put a try/catch around the $impl = new impl() line the same error is thrown. It seems like you can not throw exceptions if __set() is used through the constructor.

Reproduce code:
abstract class abs
    private $properties = array();

    public function __set( $name, $value )
        throw new Exception( "doesn't work" );

    public function __get( $name )
        throw new Exception( "doesn't work" );

class impl extends abs
    public function __construct()

$impl = new impl();

Expected result:
The uncaught exception fatal error.

Actual result:
Fatal error: Couldn't execute method impl::__set in Unknown on line 0

Call Stack:
    2.6910     262144   1. {main}() /home/derick/-:0
    2.6911     262144   2. impl->__construct() /home/derick/-:25


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-28 10:26 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 19:01:35 2015 UTC