0
votes

Why does it give me this error, I checked all the code and i'm hoping there aren't dumb mistakes. The login page is meant to display.

Fatal error: Cannot redeclare UsersController::beforeFilter() in C:\wamp\www\dale-blog\app\Controller\UsersController.php on line 64

 //line 63:
    public function beforeFilter() {
    parent::beforeFilter();
    $this->Auth->allow('add'); //Letting users register themselves
    }
3
It means Cannot redeclare UsersController::beforeFilter() !!Rikesh

3 Answers

2
votes

It means you have declared public function beforeFilter() twice in the same controller.

0
votes

I am not familiar with cakephp, but I can assure you the message implies the said function (beforeFilter) has been previously declared. Do a search for the offending duplicate and zap it out.

Happy caking, cheers

0
votes

I had the same 'mistake'. It was because the tutorial tells you that you must to code twice but it must be clear that the line that has to be modified not added is

public function beforeFilter(){
        $this->Auth->allow('index','view');
    }

in the AppController.php File