Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prestashop : Declaration of AdminLoginControllerCore::viewAccess() must be compatible with AdminControllerCore:

I was using prestashop on hosting with no problem. Now I started my home web server and I'm trying to get it working.

I tried many different prestashop versions and reinstalled them x times.. All the time problem is that, I can Access front panel, but not the backend panel..

All the time it shows Http 500 ERROR : Server can't Handle this request. Now I enabled debugging and it shows me error:

Fatal error: Declaration of AdminLoginControllerCore::viewAccess() must be compatible with AdminControllerCore::viewAccess($disable = false) in C:\xampp\htdocs\Shop\controllers\admin\AdminLoginController.php on line 27

And Line

class AdminLoginControllerCore extends AdminController{

I can't understand why this is happening, becouse I haven't edited and changed any file or folder.

like image 672
Car Paradise Avatar asked Nov 19 '25 20:11

Car Paradise


2 Answers

It happens because you have to implement a method in a child class with all parameters of a parent class method. So in your parent class viewAccess has a parameter $disable=false and you need to have it in your child viewAccess() declaration. Just put that parameter in the declaration public function viewAccess($disable=false) and you even need not use it inside. And why it was not showing on the hosting but show in a local machine it is sooner in due to different PHP versions on the servers. Because in different versions it has different error levels.

like image 146
Alexander Grosul Avatar answered Nov 21 '25 08:11

Alexander Grosul


The way to fix this is simple:

go to ROOT/controllers\admin\AdminLoginController.php al line 153 you’ll have to change public function viewAccess() to public function viewAccess($disable = false).

like image 40
Jorge Valenzuela Avatar answered Nov 21 '25 09:11

Jorge Valenzuela



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!