php - Fatal error: Cannot redeclare with call_user_func() -
i'm trying execute couple of tests in groups each 1 .php file contains 2 functions. problem each test given group has clean-up function same name (for example test10_cleanup, 10 group number). after execution of code:
$dir = __dir__ . "/tests/"; $tests = array_slice(scandir($dir), 2); foreach ($tests $test) { include("{$dir}{$test}"); $arr = get_defined_functions(); //weird note: user defined functions in reverse order //cleanup function in array's first element call_user_func($arr["user"][1]); call_user_func($arr["user"][0]); unset($arr); }
it seems unsetting , getting again defined functions not clearing previous ones. so, fixable procedural code rather using oop or should go straight ahead , exec new php process each test file?
Comments
Post a Comment