Bug #69568 [NEW]: call a private function in closure failed
| From: | guoxiao08 at gmail dot com | Date: | Mon, 04 May 2015 06:05:11 +0000 |
| Subject: | Bug #69568 [NEW]: call a private function in closure failed | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-192467@lists.php.net to get a copy of this message | ||
From: guoxiao08 at gmail dot com
Operating system: Not related
PHP version: 5.5.24
Package: *General Issues
Bug Type: Bug
Bug description:call a private function in closure failed
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 bug report at https://bugs.php.net/bug.php?id=69568&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69568&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69568&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69568&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69568&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69568&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69568&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69568&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69568&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69568&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69568&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69568&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69568&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69568&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69568&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69568&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69568&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69568&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69568&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69568&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69568&r=mysqlcfg