|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56662 Wrong access level with RUNKIT_ACC_PUBLIC
Submitted: 2005-11-19 10:06 UTC Modified: 2013-02-23 11:14 UTC
From: svenfuchs at artweb-design dot de Assigned: pollita (profile)
Status: Closed Package: runkit (PECL)
PHP Version: 5_1 CVS-2005-11-19 OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
11 - 1 = ?
Subscribe to this entry?

 [2005-11-19 10:06 UTC] svenfuchs at artweb-design dot de
Methods being added as RUNKIT_ACC_PUBLIC seem to somehow have lost their access level when they are inspected through Reflection. 

When a class containing such a method gets extended by another class that overwrites this method and is loaded later on an error gets thrown: "Access level to C::x() must be (as in class A) or weaker"

I've found this in php 5.1.0RC6 as well in previous 5.1.0RC versions. I haven't tested with other php versions.

Reproduce code:
// does not have a 'public' identifier in Reflection export:
class A {}
runkit_method_add ('A', 'x', '', '', RUNKIT_ACC_PUBLIC);
Reflection::export(new ReflectionMethod('A', 'x'));

// works perfectly well:
class B extends A { public function x() {} }
Reflection::export(new ReflectionMethod('B', 'x'));

// throws an error:
// with C.php being: <?php class C extends A { public function x() {} } ?>
Reflection::export(new ReflectionMethod('C', 'x'));

Expected result:
Method [ public method x ] { @@ (...) } 
Method [ public method x ] { @@ (...) } 
Method [ public method x ] { @@ (...) } 

Actual result:
Method [ method x ] { @@ (...) } 
Method [ public method x ] { @@ (...) } 
Fatal error: Access level to C::x() must be (as in class A) or weaker in (...)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-02-23 11:14 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: pollita
 [2013-02-23 11:14 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

This is working in my checkout and I've added a test to check for it: 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 07:05:44 2022 UTC