|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57649 runkit_import() - methods not added - multiple classes in one file
Submitted: 2007-05-05 11:11 UTC Modified: 2013-02-26 22:58 UTC
From: guessmoor at yahoo dot de Assigned: pollita (profile)
Status: Closed Package: runkit (PECL)
PHP Version: 5.2.1 OS: win xp
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:
35 + 19 = ?
Subscribe to this entry?

 [2007-05-05 11:11 UTC] guessmoor at yahoo dot de
I am running php5.2.1 as apache2.2 module
It seems that there is a problem with multiple classes in a single file with runkit_import.
The reproduce-code throws the following error:
Fatal error: Call to undefined method a::foo()

When i define 'class c' before 'class a' in the same file, everythings ok.

Reproduce code:
#file main.php
<?class b { public function foobar() { echo "foobar()\n"; } }
class a extends b {} runkit_import( "class_a.php" );
$a = new a();
#file class_a.php
<?class a { public function foo() { echo "foo()\n" } }
class c {} # Define class c before class a in this file works.

Expected result:

Actual result:
Fatal error: Call to undefined method a::foo() in X:\main.php on line 5


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-05 11:13 UTC] guessmoor at yahoo dot de
changed the summary.
 [2013-02-26 22:58 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.

The bug you described was a side-effect of a different (but no less real) bug.  
Fixed via
runkit/commit/ff3e1d5297bdd5bfbba92377eefe369cd5c6dceb for PHP5 only.

For PHP4 you can workaround it by just making sure your classes have a definition 
(even an empty one) before importing.
 [2013-02-26 22:58 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: pollita
 [2013-05-18 23:45 UTC]
Fixed for both PHP4 & PHP5 in the master branch at
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Mar 04 19:01:32 2024 UTC