|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69568 call a private function in closure failed
Submitted: 2015-05-04 06:05 UTC Modified: 2015-05-06 13:46 UTC
From: guoxiao08 at gmail dot com Assigned: levim (profile)
Status: Closed Package: *General Issues
PHP Version: 5.5.24 OS: Not related
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: guoxiao08 at gmail dot com
New email:
PHP Version: OS:


 [2015-05-04 06:05 UTC] guoxiao08 at gmail dot com
Call a private static function in a subclass, and it failed in 5.5.
However it runs normally in php 5.4

Test script:
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:

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-04 11:04 UTC]
-Status: Open +Status: Verified
 [2015-05-04 11:04 UTC]
The behavior changed with PHP 5.4.30 and PHP 5.5.14: <>. It's most likely related to the fix for bug #66622.
 [2015-05-04 11:18 UTC]
-Assigned To: +Assigned To: levim
 [2015-05-04 11:18 UTC]
@levim please check this . thanks
 [2015-05-04 11:32 UTC]
I think this is conflicts with:


class A {
    static function foo() {
        $f = function() {
            return static::class;
        return $f();

class B extends A {}



 [2015-05-06 13:42 UTC]
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
 [2015-05-06 13:46 UTC]
-Status: Verified +Status: Closed
 [2015-05-06 13:46 UTC]
Yeah we were discussing and working on this yesterday. We believe this should be fixed without other regressions.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 13 21:01:28 2024 UTC