Mr Jerry
Mr Jerry

Reputation: 1764

How to rename or overwrite php function?

How i can redefine a function in php with runkit?

$helloWorld = 'echo "Call require_once";';
runkit_function_redefine('require_once', '$word', $helloWorld);
require_once("abc.php");

i seted in php.ini

runkit.internal_override=1

when i run, it show:

Warning: runkit_function_redefine() [function.runkit-function-redefine]: require_once() not found in hhd_debug.php on line 2

Warning: require_once(abc.php) [function.require-once]: failed to open stream: No such file or directory in hhd_debug.php on line 3

Fatal error: require_once() [function.require]: Failed opening required 'abc.php' (include_path='.;xampp\php\PEAR') in hhd_debug.php on line 3

how i can fix it? please help me!

Upvotes: 2

Views: 977

Answers (1)

deceze
deceze

Reputation: 522085

I would guess this doesn't work because require_once is a language construct, not a function.
I don't know if there's any other possibility of overriding it, I'd think not.

Upvotes: 6

Related Questions