I installed the latest PunBB for testing. When I login I get redirected to an invalid HTTPS url. My test setup uses HTTP.


Debian 6
PHP 5.4, Nginx 1.2 from DotDeb repo.
SQLite 3

After some digging I trace it to the get_current_url function in include/functions.php, specifically this line:

$protocol = (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? ...

It seems that on my system $_SERVER['HTTPS'] is set, but to an empty string.

I changed that line to:

$protocol = (!isset($_SERVER['HTTPS']) || empty($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) == 'off') ? ...

And all is well. I login and get redirected correctly.