phpLiteAdmin / pla

Official github clone of the phpLiteAdmin repository
https://www.phpliteadmin.org/
173 stars 36 forks source link

Getting blank screen in 1.9.8 version #17

Closed GaneshKandu closed 5 years ago

GaneshKandu commented 5 years ago

Hi,

i am getting blank screen in 1.9.8 version of phpLiteAdmin with this error

PHP Fatal error:  Call to undefined function hash_equals() in phpliteadmin.php on line 4350

system details

phpLiteAdmin requirements https://github.com/phpLiteAdmin/pla#requirements

Dygear commented 5 years ago

You need at least version PHP 5.6.0 to use that function.

— Thank you for your time, Mark “Dygear” Tomlin.

On Aug 31, 2019, at 05:43, Ganesh Kandu notifications@github.com wrote:

 Hi,

i am getting blank screen in 1.9.8 version of phpLiteAdmin with this error

PHP Fatal error: Call to undefined function hash_equals() in phpliteadmin.php on line 4350 system details

server apache 2 php 5.3 phpLiteAdmin requirements https://github.com/phpLiteAdmin/pla#requirements

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

GaneshKandu commented 5 years ago

@Dygear Thanks for reply worked for me it will be good if you change requirement in Readme too

crazy4chrissi commented 5 years ago

Wait. We have this code there for old PHP versions:

// for php < 5.6.0
if(!function_exists('hash_equals'))
{
    function hash_equals($str1, $str2)
    {
        if(strlen($str1) != strlen($str2))
            return false;
        else {
            $res = $str1 ^ $str2;
            $ret = 0;
            for($i = strlen($res) - 1; $i >= 0; $i--)
                $ret |= ord($res[$i]);
            return !$ret;
        }
    }
}

Normally, this should ensure compatibility with older PHP versions. Either we should make that code work or drop it and raise the required PHP version. I will first check why it does not work.

crazy4chrissi commented 5 years ago

The reason is, as I guessed, the order: The workaround function is placed in lines 4194-4208. It is used in lines 4243, 4245, 4251 and 4350. These calls are in the Authorization constructor, which is called in line 760. Therefore, at this point in time, the workaround code has not been called and the function is still undefined.

We would need to move the workaround code above line 760...

It seems PHP 5.3 is still used quite a lot: https://w3techs.com/technologies/details/pl-php/5/all So I guess I will fix this and release an 1.9.8.1 ;-)

crazy4chrissi commented 5 years ago

Should be fixed with version 1.9.8.1 released just now.