Jump to content

Prestashop 1.6 admin white page


Bernhard Ernst

Recommended Posts

I recently had to copy a Prestashop 1.6 installation to my local machine for development purposes, it has been running fine for years in it's current hosting location.
After a long fight with Apache to get it running, most things worked fine (do not run this using PHP 7!).

The admin CMS gave me a white screen after login. Clearing the cache and Smarty cache did not work.
After either white page and/or running into either a 503 overloaded or timeout error, I decided to hunt down the source of the problem. The result was rather odd as explained below.
This will hopefully help others.

The problem turned out to be in Controller.php in the "run" function. I will show comments below:

public function run() {
    // This line runs
    $this->init();
    // This line never gets reached
    if ($this->checkAccess()) { // This line never gets reached

The init function itself is very short and only does three defines if they do not exist yet. I added an echo as the last line which always runs.
For some really strange reason. Just simply calling init caused the script to just simply stop. Even adding "return true;" at the end of the "init" function made no difference,

Note: There are no overrides involved in this case.

My solution ended up being:

public function run() {
    // This line runs
    if (Tools::getValue("controller", "") !== "AdminDashboard") {
        $this->init();
    }
    // This line runs
    if ($this->checkAccess()) { // This line runs

Instead of the check for the controller, I have also tried a try-catch exception check with no luck.

If would love to know if anyone else has seen this weird behaviour and has a possible explanation. This only seems to happen when AdminController is involved.

Update:
Making a copy of the "init" function and giving it a different name and then having the "run" function call this clone of "init" is another way to get around the white screen error.

Edited by Bernhard Ernst (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...