Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52407 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42272 invoked from network); 16 May 2011 19:37:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2011 19:37:06 -0000 Authentication-Results: pb1.pair.com header.from=ircmaxell@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ircmaxell@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.83.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ircmaxell@gmail.com X-Host-Fingerprint: 74.125.83.170 mail-pv0-f170.google.com Received: from [74.125.83.170] ([74.125.83.170:42617] helo=mail-pv0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DD/A1-26716-1EC71DD4 for ; Mon, 16 May 2011 15:37:06 -0400 Received: by pvg16 with SMTP id 16so2625079pvg.29 for ; Mon, 16 May 2011 12:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=z1PChKG6Q57zFVyAMTAgCLjea85nnw0aHSjKM7Gtbyo=; b=j9LEgwbyxXPBJxY+DqoUH4+2i4cx3QRrM89TlR/rEAdk4HzwxJVatlyuHudxdnzVPG hq+l6Ujxscu/IC3njEZzCTJ3t8855LHy4OQ5gxH9fuaZGe1Amp3je1kbQg5QcGYSbQj7 Fef3QVdh/vjFtsnUUG6b1h+dTl+HaGQJEhNEg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=DDB5PU6v8iV5UYyYNkXqmz9qyP+apz8fXFygdiPqw/ABhynoQ3Ntg5YdlxdhMEGcBZ F+0Q6qN6qGbF2ivguRU4PWuMAYOeRwKJzZMH8C5CLxel5Bm6MyVFm31CsDiy67wIwWWx 28LA5HA+XgrxvLBIEWuWkV0OLthh8sQ7p7O6U= MIME-Version: 1.0 Received: by 10.68.36.194 with SMTP id s2mr199643pbj.119.1305574622185; Mon, 16 May 2011 12:37:02 -0700 (PDT) Received: by 10.68.52.99 with HTTP; Mon, 16 May 2011 12:37:02 -0700 (PDT) In-Reply-To: <4DD179AA.6010509@sugarcrm.com> References: <1305570720.1344.535.camel@guybrush> <4DD179AA.6010509@sugarcrm.com> Date: Mon, 16 May 2011 15:37:02 -0400 Message-ID: To: Stas Malyshev Cc: Andrew Curioso , =?ISO-8859-1?Q?Johannes_Schl=FCter?= , "internals@lists.php.net" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Inconsistencies with constructors in SPL From: ircmaxell@gmail.com (Anthony Ferrara) > No and no. __call is not called for ctors, for obvious reasons (__call is an > object method, and before ctor is done the object is not ready). It was > always this way. It is called from constructors, just not *for* constructors: class test { public static function __callStatic($name, $args) { printf("Static: %s\n", $name); } public function __call($name, $args) { printf("Parent Instance: %s\n", $name); } } class test2 extends test { public function __construct() { $this->bar(); parent::__construct(); } public function __call($name, $args) { printf("Instance: %s\n", $name); } } $foo = new Test2(); Results in: Instance: bar PHP Fatal error: Cannot call constructor in... While I do agree that it *shouldn't* call __call/__callStatic for constructors, it does for other methods... >> I'd rather see calls to non-existent methods generate a catachable >> fatal error (rather than a hard fatal error that's currently thrown). > > Personally, I like this "catchable fatal error" business less and less. It's > an awkward way of doing an exception with all exception downsides and none > of the upsides... That's fair, but if we buy that, let's have at least an option to convert all errors to exceptions. That way there are no "catchable errors", just exceptions for errors over a specified level (E_WARNING for example)... >> But silently ignoring a called function, something just doesn't sit >> right about that... > > We're already doing it :) Try: > class Foo {} > $a = new Foo(); > > You just ignored a non-existing ctor. I guess that's fair. I just don't care for special-case logic in general. It generates too many edge-cases. That's not saying this is worth it or not, but just my preference... Anthony