1

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.

Mohammed H
  • 6,880
  • 16
  • 81
  • 127

1 Answers1

5

See the top of the code, line 40:

class Controller extends Object {

That method is Controller::header, so does not override header. You can't "override" PHP functions: you'll simply get an error.

lonesomeday
  • 233,373
  • 50
  • 316
  • 318