Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55984 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48001 invoked from network); 28 Oct 2011 15:51:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Oct 2011 15:51:59 -0000 Authentication-Results: pb1.pair.com header.from=ralph@ralphschindler.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=ralph@ralphschindler.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ralphschindler.com from 209.85.161.170 cause and error) X-PHP-List-Original-Sender: ralph@ralphschindler.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:44026] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/45-22011-D9FCAAE4 for ; Fri, 28 Oct 2011 11:51:58 -0400 Received: by ggnk5 with SMTP id k5so4261501ggn.29 for ; Fri, 28 Oct 2011 08:51:53 -0700 (PDT) Received: by 10.151.122.14 with SMTP id z14mr3225024ybm.59.1319817112724; Fri, 28 Oct 2011 08:51:52 -0700 (PDT) Received: from ralph-mac.local (ip174-73-14-247.no.no.cox.net. [174.73.14.247]) by mx.google.com with ESMTPS id q4sm25661960anp.7.2011.10.28.08.51.51 (version=SSLv3 cipher=OTHER); Fri, 28 Oct 2011 08:51:51 -0700 (PDT) Message-ID: <4EAACF96.2090306@ralphschindler.com> Date: Fri, 28 Oct 2011 10:51:50 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1 MIME-Version: 1.0 To: internals@lists.php.net References: <1e6843072fd03c1ffe2f7394c824e797@localhost> In-Reply-To: <1e6843072fd03c1ffe2f7394c824e797@localhost> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] No inheritance check in constructor ? From: ralph@ralphschindler.com (Ralph Schindler) Hi Jean-Sebastien, I'd say this is a harder-to-grasp concept and leads to this common misconception. Have a look here, particularly at my reply in the comments section: http://devzone.zend.com/article/15273 In a nutshell, ctors (constructors) are not subject to LSP (liskov sub. principle) because a type does not yet exist; the type is the product of the ctor. -ralph On 10/28/11 10:33 AM, Jean-Sébastien H. wrote: > Ok it's a documented behaviour, I should read more carefully. > > http://php.net/manual/en/language.oop5.decon.php > Unlike with other methods, PHP will not generate an E_STRICT level > error message when __construct() is overridden with different parameters > than the parent __construct() method has. > > > But I think, it's a lack in PHP ? > > On Fri, 28 Oct 2011 17:22:53 +0200, Jean-Sébastien H. > wrote: >> Hi, >> >> Is it an expected behaviour ? >> >> See attached test file. >> >> >> ---- EXPECTED OUTPUT >> Strict Standards: Declaration of ObjChild::method() should be >> compatible with that of ObjParent::method() in %s on line 15 >> >> Strict standards: Declaration of ObjChild::__construct() should be >> compatible with that of ObjParent::__construct() in %s on line 17 >> ---- ACTUAL OUTPUT >> Strict Standards: Declaration of ObjChild::method() should be >> compatible with that of ObjParent::method() in %s on line 15 >> >> ---- FAILED >> >> >> >> NB : >> The real actual output of the phpt is empty. Can we test strict error >> with run-tests ? >> >> >> Regards, >> -- >> Jean-Sébastien H. >> au-fil-du.net >