I saw a function in cakephp-1.2 core files.
/**
* Convenience method for header()
*
* @param string $status
* @return void
* @access public
*/
function header($status) {
header($status);
}
see https://github.com/cakephp/cakephp/blob/1.2/cake/libs/controller/controller.php#LC638
What may the reason they are redefining the function with same name?
Will it work? I think the header function will create infinite recursion.
I don’t know how to check whether it creates infinite recursion.
See the top of the code, line 40:
That method is
Controller::header, so does not overrideheader. You can’t “override” PHP functions: you’ll simply get an error.