|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57749 Fatal error "Cannot redeclare" when using runkit_function_redefine
Submitted: 2007-07-18 05:15 UTC Modified: 2013-02-23 18:56 UTC
From: bogdan at acunetix dot com Assigned: pollita (profile)
Status: Closed Package: runkit (PECL)
PHP Version: 5.2.1 OS: Ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bogdan at acunetix dot com
New email:
PHP Version: OS:


 [2007-07-18 05:15 UTC] bogdan at acunetix dot com
affects runkit 0.9:

I'm using runkit_function_redefine to redefine a system function (passthru). I would like to be able to intercept the parameters passed to this function in old_passthru.
For some files, the code bellow is working great. 

However, if you have an PHP file with any function defined, runkit returns an Fatal error: Cannot redeclare my_function().
If the function is commented out, it's working fine.

Reproduce code:
File /var/www/tr/index.php

function my_function() {
// redefine passthru
'passthru',    // function to redefine
'',			   // number of parameters		
			   // code	
$args = func_get_args();
echo "<b>passthru</b> params = [<b>" .  func_get_arg (0) . "</b>]<br>";
return call_user_func_array("old_passthru", $args);

// call passthru


this is html already

Expected result:
passthru params = [ls]
index.php phpinfo.php runkit.php
this is html already

Actual result:
Fatal error: Cannot redeclare my_function() (previously declared in /var/www/tr/index.php:4) in /var/www/tr/index.php on line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-05 16:02 UTC] dzenovich at gmail dot com
The solution of this issue can be found here:
 [2009-11-06 04:51 UTC] dzenovich at gmail dot com
Here is a fix for zts
 [2013-02-23 18:56 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: pollita
 [2013-02-23 18:56 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 should be fixed by:
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 18:01:30 2024 UTC