Bug #69568 [Ver]: call a private function in closure failed

From: Date: Wed, 06 May 2015 13:42:38 +0000
Subject: Bug #69568 [Ver]: call a private function in closure failed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-192516@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69568&edit=1 ID: 69568 Updated by: laruence@php.net Reported by: guoxiao08 at gmail dot com Summary: call a private function in closure failed Status: Verified Type: Bug Package: *General Issues Operating System: Not related PHP Version: 5.5.24 Assigned To: levim Block user comment: N Private report: N New Comment: this has been fixed in master by nikic , anyway, due to ABI change, I don't think the change can be merged downward to 5.6/5.5 Previous Comments: ------------------------------------------------------------------------ [2015-05-04 11:32:42] laruence@php.net I think this is conflicts with: <?php class A { static function foo() { $f = function() { return static::class; }; return $f(); } } class B extends A {} var_dump(B::foo()); ?> :< ------------------------------------------------------------------------ [2015-05-04 11:18:28] laruence@php.net @levim please check this . thanks ------------------------------------------------------------------------ [2015-05-04 11:04:58] cmb@php.net The behavior changed with PHP 5.4.30 and PHP 5.5.14: <http://3v4l.org/WSIu7>. It's most likely related to the fix for bug #66622. ------------------------------------------------------------------------ [2015-05-04 06:05:11] guoxiao08 at gmail dot com Description: ------------ Call a private static function in a subclass, and it failed in 5.5. However it runs normally in php 5.4 Test script: --------------- <?php class A { private static function testprivate() { return 1; } public static function test() { return function() { return self::testprivate(); }; } } class B extends A { } $fn = B::test(); echo $fn(); Expected result: ---------------- 1 Actual result: -------------- Fatal error: Call to private method A::testprivate() from context 'B' in /tmp/test.php on line 9 Call Stack: 0.0048 645824 1. {main}() /tmp/test.php:0 0.0048 646304 2. B::{closure:/tmp/test.php:8-10}() /tmp/test.php:18 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69568&edit=1

« previous php.bugs (#192516) next »