MantisBT - TestLink
View Issue Details
0006015TestLinkAvailable Fixespublic2013-10-31 17:512016-04-08 18:20
kenden 
fman 
normalcrashalways
closedfixed 
firefox 25linux mint15 64b
1.9.8 (2013 Q3 - bug fixing) 
1.9.9 (2013 Q4 - bug fixing) 
mysql
firefox
PHP 5.4.9-4ubuntu2.3
READY FOR TESTING
0006015: Webserver: Nginx - https is forced incorrectly
After installing, I am redirected to the page:
https://localhost/testlink/login.php [^]

And I see the content:

Unable to connect

Firefox can't establish a connection to the server at localhost.
Install Nginx + php5 + mysql
(following those steps:
http://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-lemp-on-ubuntu-13.04 [^])

Create a testlink database
Install Testlink 1.9.2

At the end of the installation, click the login link
----> get the problem
The problem might be because of using nginx.
I used testlink before with Apache2 with no problem.

After investigating, it seems the problem is caused because the value
_SERVER["HTTPS"] has no value

Calling phpinfo() shows "no value".

To fix this, edit the function get_home_url()
in file lib/functions/configCheck.php

Change line:

else if ( isset( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) )

by

else if ( !empty( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) )


Can this be committed?
No tags attached.
related to 0007495closed fman After successful installation, it is not possible to login as admin, if Nginx is used as a reverse Proxy 
child of 0005897closed fman Availables hot-fixes for 1.9.8 & How To get full fixed package from gitorious 
Issue History
2013-10-31 17:51kendenNew Issue
2013-10-31 20:14fmanSummaryHttps is forced incorrectly => Webserver: Nginx - https is forced incorrectly
2013-10-31 20:30fmanNote Added: 0019939
2013-10-31 20:32fmanNote Added: 0019940
2013-10-31 20:32fmanAssigned To => fman
2013-10-31 20:32fmanStatusnew => feedback
2013-10-31 22:03kendenNote Added: 0019941
2013-10-31 22:03kendenStatusfeedback => assigned
2013-11-01 09:11fmanNote Added: 0019944
2013-11-01 09:12fmanFixed in Version => 1.9.9 (2013 Q4 - bug fixing)
2013-11-01 09:12fmanNote Added: 0019945
2013-11-01 09:12fmanStatusassigned => resolved
2013-11-01 09:12fmanResolutionopen => fixed
2013-11-01 09:13fmanRelationship addedchild of 0005897
2013-11-17 09:53fmanNote Added: 0020054
2013-11-17 09:53fmanStatusresolved => closed
2016-04-08 18:20fmanRelationship addedrelated to 0007495

Notes
(0019939)
fman   
2013-10-31 20:30   
solution can be

else if ( isset( $_SERVER['HTTPS'] ) && !empty( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) )
(0019940)
fman   
2013-10-31 20:32   
if you declare
>> Install Testlink 1.9.2

you can not set version to 1.9.8, please clarify.
Issues on version < 1.9.7 are ignored if you can not reproduce on 1.9.8

I only test on apache
(0019941)
kenden   
2013-10-31 22:03   
Sorry that was a typo.
It is not
"Install Testlink 1.9.2"
it should be
"Install Testlink 1.9.8"

Nginx is becoming the new Apache2 it seems.

Regarding your solution:

else if ( isset( $_SERVER['HTTPS'] ) && !empty( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) )

empty() already checks if a variable exists, so if you call empty, there is no need to call isset().

http://php.net/manual/en/function.empty.php [^]
"A variable is considered empty if it does not exist or if its value equals FALSE. empty() does not generate a warning if the variable does not exist."
So

else if ( !empty( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'] ) != 'off' ) )

should be enough.
(0019944)
fman   
2013-11-01 09:11   
checked how MantisBT fixed it, same to yours approach.
Fixed and commited

thanks
(0019945)
fman   
2013-11-01 09:12   
https://gitorious.org/testlink-ga/testlink-code/commit/f76ba33cf81437707393b0b6286919daf6f28eff [^]
(0020054)
fman   
2013-11-17 09:53   
1.9.9 Released