Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69430 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84173 invoked from network); 1 Oct 2013 10:17:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Oct 2013 10:17:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.54 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.54 mail-qa0-f54.google.com Received: from [209.85.216.54] ([209.85.216.54:42550] helo=mail-qa0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CB/30-17232-C41AA425 for ; Tue, 01 Oct 2013 06:17:48 -0400 Received: by mail-qa0-f54.google.com with SMTP id bv4so3185566qab.13 for ; Tue, 01 Oct 2013 03:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=JY/tCOne4NV7eawFWU2XkKwOLRsWO6uJ0NGiFegynT0=; b=m/kfw6MX8PLBfd8j5Snw6r8cv+GGanA2+PqiqeL+cPpe0mjkePCeg9X2eIdjTdxdHJ MYKuWdzZGSz9OdcY9vhAp7yYLtpPw/c5P87nHLf1sgcyknwuHqNMqqcVCCmsrnhQuugg zq3bHR4EJ1EsVcPw1cw/zdmDc0cLJ9Y1H7RSUd5nvmT7fYepyRFSTtskR+R1USatlO3q 6FU59LexBQ9cazZtX8YicqHFCem7RfB3ONWk0Yl1WFTXpS8Vgc/WBCadnP765N1NzDYI JsUT/jdC3vHp/BkoWfnC/bs6F3/h2h5PcfdsvPV6cbYF2NLNB9+XWjtaPBpAa4qG/tp2 XgXw== MIME-Version: 1.0 X-Received: by 10.224.92.201 with SMTP id s9mr19841669qam.85.1380622665825; Tue, 01 Oct 2013 03:17:45 -0700 (PDT) Received: by 10.140.22.71 with HTTP; Tue, 1 Oct 2013 03:17:45 -0700 (PDT) In-Reply-To: <004501cebafe$1f46b470$5dd41d50$@tutteli.ch> References: <004501cebafe$1f46b470$5dd41d50$@tutteli.ch> Date: Tue, 1 Oct 2013 12:17:45 +0200 Message-ID: To: Robert Stoll Cc: PHP Internals Content-Type: multipart/alternative; boundary=089e0149d26e90c4c604e7ab43df Subject: Re: [PHP-DEV] __construct is like a normal method but without E_STRICT From: tyra3l@gmail.com (Ferenc Kovacs) --089e0149d26e90c4c604e7ab43df Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Sep 26, 2013 at 11:19 PM, Robert Stoll wrote: > Heya > > > > I would like to have some opinions on the topic inconsistency between > methods and __construct > > See the following code: > > > > class A { > > function __construct($a) {} > > function foo($a) {} > > } > > class B extends A { > > function __construct($a, $b) {} > > function foo($a, $b) {} > > } > > > > If you work in strict mode, then you will see the error message > > Strict Standards: Declaration of B::foo() should be compatible with > A::foo($a) > > > > I perfectly understand that the strict standard cannot be applied to the > __construct and I would not suggest to change that. But I think it is > somewhat strange that I am able to call __construct as it was a normal > method from everywhere. > > Am I the only one thinking this, is there actually someone who is using > __construct as re-initialising method? > > > > Cheers, > > Robert > > > > > > > > php doesn't invoke the parent's constructor from the subclass if the subclass also have a constructor, so in that case calling parent::__construct() manually is your only option if you want the parent constructor to be executed. --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --089e0149d26e90c4c604e7ab43df--