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

From: Date: Mon, 04 May 2015 11:18:29 +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-192472@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: +Assigned To: levim Block user comment: N Private report: N New Comment: @levim please check this . thanks Previous Comments: ------------------------------------------------------------------------ [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 (#192472) next »