Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:85977 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 81062 invoked from network); 27 Apr 2015 21:15:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Apr 2015 21:15:14 -0000 Received: from [127.0.0.1] ([127.0.0.1:3901]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 81/8C-17556-2E6AE355 for ; Mon, 27 Apr 2015 17:15:14 -0400 Authentication-Results: pb1.pair.com header.from=php@lvl.fastmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=php@lvl.fastmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain lvl.fastmail.com designates 66.111.4.25 as permitted sender) X-PHP-List-Original-Sender: php@lvl.fastmail.com X-Host-Fingerprint: 66.111.4.25 out1-smtp.messagingengine.com Received: from [66.111.4.25] ([66.111.4.25:36222] helo=out1-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 07/7C-17556-436AE355 for ; Mon, 27 Apr 2015 17:12:20 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id DF276207AC for ; Mon, 27 Apr 2015 17:12:17 -0400 (EDT) Received: from web5 ([10.202.2.215]) by compute4.internal (MEProxy); Mon, 27 Apr 2015 17:12:17 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=lmF RYrW7pgSjtnQ+48XZ1mSI4Do=; b=p0XSkQYcd07OPvb54fSf0UAEB6Uv0V/5Ho+ I5YFjocRvmFqMAaK/4vC2LkPEApRRjJwOS08vb1ag6/9mlhOl9LQW64pfUF7Wz9D lKpoyI+4IKPL2ycFgOkSHXxiN9YgmOca+ogE1mLYDO5mR9CYd19mqf2nVnr1e5Mx lx1nPMlU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=lmFRYrW7pgSjtnQ+48XZ1mSI4Do=; b=OXxGq Tu75VrVpwk5Pg0rUGXS7QIH3U031dMl6IjtvBLAXpPfkX8hxauf+Hph45u5z+iRh WBvw+tAzfSduTJSWcJY5xIzh4pZ1qxo9L5vZQH0C4en5Fem5SyOVHEorKLRy5B81 nF/gOPFNIglfG9HE7pAMUxsdkbskhy5R2iWAs4= Received: by web5.nyi.internal (Postfix, from userid 99) id B2E08A7E414; Mon, 27 Apr 2015 17:12:17 -0400 (EDT) Message-ID: <1430169137.2886384.259330117.00E1734F@webmail.messagingengine.com> X-Sasl-Enc: pVi5xrnJ0m814m7k/reEJu+mfzE7JzhOWHSQkNoL1ls8 1430169137 To: internals@lists.php.net MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-83dc69c8 Date: Mon, 27 Apr 2015 23:12:17 +0200 Subject: Resolution of static variables in the function scope not using forwarded calling information? From: php@lvl.fastmail.com Hello all, I ran into some very strange behavior while experimenting with static function variables. It looks like a bug to me, but I couldn't find any previous reports or discussions about the subject, so I wanted to gather your input before submitting it as such. Static variables in the function scope appear to be resolved using late static binding: the content of the variable in that function is shared amongst all instances of a class, though each subclass gets its own separate variable space. This is pretty logical and works fine. As an example, let's create classes Base => Animal => {Cat,Dog}. Base has a function that describes the class, and caches the result in a static function variable $description. Calling describe() on the three different classes correctly gives us three different results: http://3v4l.org/Qldve However, once you override the describe function in Animal and call parent::describe() from within, it looks like all calling information is lost: the resolution of $description in Base's function scope now always points to Animal's variable space. For example: http://3v4l.org/qWrvf Overriding the function in one of the childmost classes like Dog gives an even stranger result: $description is now correctly a separate value in Cat vs Dog, but calling Animal::describe() now uses the value left by its child class Cat?! See: http://3v4l.org/61P72 Any thoughts? Thanks, Laszlo