function main() { test(); fb_rename_function('foo', 'baz'); test(); fb_rename_function('bar', 'foo'); test(); }
function main() { var_dump(foo()); var_dump(bar()); fb_rename_function('bar', 'baz'); fb_rename_function('foo', 'bar'); var_dump(bar()); }
<?php function err($code, $msg) { var_dump($code, $msg); } set_error_handler('err'); function test1() { } function test2() { } fb_rename_function('test1', 'test3'); fb_rename_function('test2', 'test1'); fb_rename_function('test1', 'test2'); fb_rename_function('test3', 'test1');
<?php function a() { echo "Hello from a\n"; } function b() { echo "I am b\n"; } function callfns($name, $name2) { echo "Calling {$name}\n"; $name(); echo "Calling {$name2}\n"; $name2(); } callfns('a', 'b'); fb_rename_function('a', 'old_a'); fb_rename_function('b', 'a'); fb_rename_function('old_a', 'b'); callfns('a', 'b'); fb_rename_function('extract', 'a');
function bar() { $orig = "foo"; $new = "my_{$orig}"; var_dump(fb_rename_function($new, "foo")); }
<?php function test1() { var_dump(__METHOD__); } function test2() { var_dump(__METHOD__); } function test($test) { test1(); TeSt1(); $test(); $test = strtolower($test); $test(1, 2, 3); } test('Test1'); fb_rename_function('tEst1', 'fiz'); fb_rename_function('test2', 'Test1'); test('teSt1');
<?php function bungle($s) { return 314159; } function prefix() { return "__rename_func_"; } $stub_name = prefix() . 'strtoupper'; var_dump(strtoupper('tweet')); fb_rename_function('strtoupper', $stub_name); fb_rename_function('bungle', 'strtoupper'); var_dump(strtoupper('tweet')); // release stringdata unset($stub_name); // try to allocate something in that memory $stub_name = prefix() . 'hagfish'; $stub_name = prefix() . 'strtoupper'; fb_rename_function('strtoupper', 'bungle'); fb_rename_function($stub_name, 'strtoupper'); var_dump(strtoupper('tweet'));
<?php function bungle($s) { return 314159; } function prefix() { return "__rename_func_"; } $stub_name = prefix() . 'strlen'; var_dump(strlen('')); fb_rename_function('strlen', $stub_name); fb_rename_function('bungle', 'strlen'); var_dump(strlen('')); // release stringdata unset($stub_name); // try to allocate something in that memory $stub_name = prefix() . 'hagfish'; $stub_name = prefix() . 'strlen'; fb_rename_function('strlen', 'bungle'); fb_rename_function($stub_name, 'strlen'); var_dump(strlen(''));
<?php function test1() { print __FUNCTION__; } function test2() { print __FUNCTION__; } fb_rename_function('test2', 'test3'); fb_rename_function('test1', 'test2'); teSt2(); fb_rename_function('test2', 'test3'); teSt2();
<?php function a() { echo "Hello from a\n"; } function b() { echo "I am b\n"; } function callfns($name, $name2) { echo "Calling {$name}\n"; $name(); echo "Calling {$name2}\n"; $name2(); } callfns('a', 'b'); fb_rename_function('a', 'old_a'); fb_rename_function('b', 'a'); fb_rename_function('old_a', 'b'); callfns('a', 'b');
<?php function test1() { echo "test1\n"; } function test3() { echo "test3\n"; } function baz($test1, $test2) { var_dump(function_exists("Test1")); var_dump(function_exists("tEst2")); var_dump(function_exists($test1)); var_dump(function_exists($test2)); } baz("teSt1", "test2"); fb_rename_function("test1", "test2"); baz("TEst1", "test2"); fb_rename_function("test3", "test1"); baz("test1", "test2"); test1(); test2();
<?php function one() { echo 'one'; } var_dump(fb_rename_function('one', 'two'));
<?php function one() { echo 'one'; } fb_rename_function('one', 'two'); fb_rename_function('two', 'three'); three();