|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59971 APD rename_function with PHPUnit causes PHP to return code 1
Submitted: 2011-09-27 14:15 UTC Modified: 2015-02-26 07:36 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: daniel at danielennis dot com Assigned:
Status: Suspended Package: apd (PECL)
PHP Version: 5.3.6 OS: Debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2011-09-27 14:15 UTC] daniel at danielennis dot com
When using rename_function to override internal functions,
APD makes the PHP Process return an error code of 1 (which triggers unit test runners to think the tests failed)

Removing the use of APD makes the error code go away.

Reproduce code:
rename_function("touch", "__php_touch");
eval ("function touch() { var_dump('You called touch!');}");


// cleanup
rename_function("touch", uniqid("touch"));
rename_function("__php_touch", "touch");

Expected result:
return code of 0

Actual result:
return code of 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-27 14:57 UTC] daniel at danielennis dot com
actually, it appears that test case does not cause it, it appears to be caused when used with phpunit

tested demonstration when you have PHP unit installed on your system:

issue 'phpunit example.php; echo $?' and itll echo:

>>> phpunit x; echo $?
PHPUnit 3.5.15 by Sebastian Bergmann.


Time: -1317149460 seconds, Memory: 6.50Mb

OK (1 test, 1 assertion)
 [2012-08-07 19:37 UTC] chris dot nash at phoenixage dot com
Have replicated the issue with PHP 5.3.10 and OS X Lion. It appears the cleanup 
code in the APD extension throws an error and alters the process exit code, but I 
couldn't trace it down to anything more specific.

The only suggestion I have was that if it's just the function rename/copy/etc 
functionality from APD you need, use runkit instead - appears to work fine on current PHP versions.
 [2012-09-30 11:46 UTC] glaslos at gmail dot com
I only needed the function reaming and overwriting feature and wasn't able to 
build it on PHP >= 5.4 so I "extracted" those two features:
 [2015-02-26 07:36 UTC]
-Status: Open +Status: Suspended
 [2015-02-26 07:36 UTC]
APD hasn't had a release in 10 years, this means it's source code is way out of sync with modern PHP.

I'm going to mark this bug as suspended, the report can still be found if a maintainer for APD comes forward.

Sorry about the wait.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Jan 29 16:05:54 2023 UTC