Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102011 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19105 invoked from network); 30 Mar 2018 15:49:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Mar 2018 15:49:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:55370] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 58/F0-06325-B6C5EBA5 for ; Fri, 30 Mar 2018 10:49:00 -0500 Received: by mail-wm0-f54.google.com with SMTP id b127so15391537wmf.5 for ; Fri, 30 Mar 2018 08:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=TeIdLaGnikSvvKVN3dy0HW/XywvnZ1KViEM6Nf5zCRA=; b=r3gP+ih6XerWH+XU6755CXif4I/6FuBu18Mc9magJbvvVuQhdpv/DcJgiGdxXaQR1q Qlge7k9kYyPQX8gFf91PjECmmD3zqX5G6bJE78wbSMcsIwdA01cc1qIm8OPhwa48we8y fOdJOJE+MArSLtPDhNBDIQJ2ymnI1vZ08PTi07ML/+eJW9w9Vij6jShFM5X6VL9a17zU 2Uv6/Zz8Eb2mjT7cByVBSxtT3UZWdD/iWM1tWr7jhlo+aTmpwvnv4n9e6jctBYR2Bn9b uAn6KW9df9FtK6Yrf8J6P3+JHTT3yLwiMKtxmmCYJdVu66wwXXimOHZalNxwP6pctBNc +scQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=TeIdLaGnikSvvKVN3dy0HW/XywvnZ1KViEM6Nf5zCRA=; b=lqr3NE+yEk3xQOwpRpUEU4VFDf90HuydG8Nke2LLNSCknT4z4VCef2R501e/cPHhkm KggUrYnLND36v36R+IVjKBGewPjD0RYGYdVe6Q2EI6TNpR6eF+EvwXd6oergg8tl75jt fjLvNa7vUHLWx0Q1shiFOyL7b/h6u5Wy0XzmvANA46Ep+C7F1a4+PBI56XWJ5pKYX5Om K8Ds7hYEHeRISdIOPejw5USiNfz+rYGdWbffncs51pUtj2JiaDRNsLphbalmb61yjeLO bhOFDybjOsrr63jhicK1lpx/41H7OaRmhF2/9UI3CkpyYBtQIRDq94Jyvot2XveHtB9Q 02Mg== X-Gm-Message-State: AElRT7Hz14Dms5zS/tkNokHu45s/8YXY02UQmUFgAKruXyNBx+GBNRrc BQzhtunc2d0iqDU+PkNtX47vSYnW X-Google-Smtp-Source: AIpwx49X6IZD42UmWurns7JWjaU6pGZ2J2729gE+M81/SyxTqGzIE3ngAdBTQNWaQGoDmCBZaBU3+Q== X-Received: by 10.28.197.205 with SMTP id v196mr2574320wmf.37.1522424935941; Fri, 30 Mar 2018 08:48:55 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4b86:4b00:819b:f418:bec2:f1af? ([2a00:23c4:4b86:4b00:819b:f418:bec2:f1af]) by smtp.googlemail.com with ESMTPSA id q90sm16884456wrb.6.2018.03.30.08.48.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Mar 2018 08:48:54 -0700 (PDT) To: PHP Internals Message-ID: <208accff-567c-48f4-99db-56df938ff14b@gmail.com> Date: Fri, 30 Mar 2018 16:48:51 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB Subject: Re: [PHP-DEV] On constructors: BC Break and Class compiler Improvements From: rowan.collins@gmail.com (Rowan Collins) Hi all, I thought people might be amused to hear that, almost exactly 8 years after it was proposed, this very reasonable decision caused a lot of head-scratching yesterday: From:       Stanislav Malyshev Date:       2010-04-03 1:17:44 > So, I think we've got consensus about not having class-named ctors in > namespaced classes in trunk, and unless I hear some screams I'll commit > the patch early next week. > > What about the 5.3? (BTW, I don't see any difference between 5.3.0 and > anything later, could anybody point it to me?) > We could: > 1. Kill the class-named ctors for NS in 5.3 (some BC break, though I > have hard time believing anybody used it so far, but who knows) > 2. Kill the warning and just ignore the other one if __ctor is there. > 3. Leave everything as-is. While migrating an application off a horrifyingly old server, my friend (who shall remain anonymous to protect the innocent) could not understand why a private property of a class, initialised in the constructor, was null when the code ran on the new server. It turns out that the code in question looked like this: namespace Foo\Bar; class Baz {     public function baz() {         // initialisation here     } } This code runs correctly *only* on PHP versions from 5.3.0 to 5.3.2 inclusive, because in 5.3.3, Stas's patch mentioned above landed, and the method is no longer detected as a constructor. It just so happens that 5.3.2 was the version bundled with Ubuntu 10.04, and somehow the code remained untested on any other version in all this time. Out of curiosity, I tracked down why this was changed, and found this thread. [https://marc.info/?l=php-internals&m=127014823111792] The awkwardness of allowing both constructor styles was only discovered as people started to move PEAR-style class names to namespaced ones, so tweaking it in 5.3.3 made perfect sense. But, as Stas said in the message quoted above, who knows what features people will take advantage of, documented or otherwise! Regards, -- Rowan Collins [IMSoP]