Re: Inconsistencies with constructors in SPL

From: Date: Mon, 16 May 2011 18:28:47 +0000
Subject: Re: Inconsistencies with constructors in SPL
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-52400@lists.php.net to get a copy of this message
Hi!
A fatal error is thrown if you try to call parent::__construct() from a subclass of SplObjectStorage.
I'm thinking maybe it'll be useful to make parent::__construct silently succeed if parent class exists but has no ctor. The reason for that that for many classes you _have_ to call parent ctor for normal functionality, on the other hand some of them may not have it clearly documented if ctor method exists or not. Also, even if ctor method doesn't exist in fact there's always default empty one (since you can create object without explicitly writing a ctor). So, if we allow parent ctor always succeed it will make the code more robust. What do you think? -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#52400) next »