|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-28 10:26 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 14:00:01 2025 UTC |
Description: ------------ 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: --------------- <?php 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() { $this->counter++; } } $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