MantisBT - TestLink
View Issue Details
0005209TestLinkNew Featurepublic2012-09-06 19:462014-07-27 10:04
satishk 
kinow 
highmajoralways
closedfixed 
LinuxCentos6.2
1.9.4 (2012 Q3 - bug fixing) 
2.0 (planned) 
MYSQL
Chrome
PHP Version 5.3.3
READY FOR TESTING
0005209: Login.php fails to load on new deployment with SSL enabled (missing function utf8_strtolower())
The login page throws a HTTP 500 error when deploying testlink 194 with SSL enabled. The apache ssl_error_log file has the following exception.

PHP Fatal Error: Call to undefined function utf8_strtolower() in var/www/html/testlink_194_lib/functions/gpc_api.php on line 17.
1) Deploy test link v 194 with ssl enabled
2) Launch the testlink url and complete the installation steps for a new install.
3) Launch the testlink page after the install

Expected:
The login page is displayed

Observed:
The login.php page generates an exception

Note: Commenting the line with reference to utf8_strtolower() does not generate the exception.
No tags attached.
child of 0005193closed fman Availables hot-fixes for 1.9.4 & How To get full fixed package from gitorious 
? gpc_api.php (14,193) 2012-09-10 16:06
http://mantis.testlink.org/file_download.php?file_id=2860&type=bug
Issue History
2012-09-06 19:46satishkNew Issue
2012-09-07 15:32kresssNote Added: 0017418
2012-09-07 15:34kresssNote Added: 0017419
2012-09-07 16:51fmanNote Added: 0017420
2012-09-07 16:51fmanNote Edited: 0017420bug_revision_view_page.php?bugnote_id=17420#r2060
2012-09-07 16:52fmanNote Added: 0017421
2012-09-07 16:53fmanNote Edited: 0017421bug_revision_view_page.php?bugnote_id=17421#r2062
2012-09-10 13:57kresssNote Added: 0017428
2012-09-10 14:28kinowAssigned To => kinow
2012-09-10 14:28kinowStatusnew => work in progress
2012-09-10 15:35kinowNote Added: 0017431
2012-09-10 16:00fmanNote Added: 0017433
2012-09-10 16:02kinowNote Added: 0017434
2012-09-10 16:06kinowFile Added: gpc_api.php
2012-09-10 16:09kinowNote Added: 0017435
2012-09-10 17:34kresssNote Added: 0017436
2012-09-10 17:43kinowNote Added: 0017437
2012-09-10 17:57kinowNote Added: 0017438
2012-09-11 19:51satishkNote Added: 0017453
2012-09-11 19:58kinowStatuswork in progress => assigned
2012-09-11 19:59kinowTask Workflow StatusTBD => READY FOR TESTING
2012-09-11 19:59kinowNote Added: 0017454
2012-09-11 19:59kinowStatusassigned => resolved
2012-09-11 19:59kinowFixed in Version => 2.0 Alpha 3
2012-09-11 19:59kinowResolutionopen => fixed
2012-09-12 17:53fmanFixed in Version2.0 Alpha 3 => 2.0 (planned)
2012-09-19 06:03fmanSummaryLogin.php fails to load on new deployment with SSL enabled => Login.php fails to load on new deployment with SSL enabled (missing function utf8_strtolower())
2012-09-19 06:04fmanRelationship addedchild of 0005193
2014-07-27 10:04fmanNote Added: 0021341
2014-07-27 10:04fmanStatusresolved => closed

Notes
(0017418)
kresss   
2012-09-07 15:32   
Same issue here.

RHEL 6.3
PHP 5.3.3
PostgreSQL 8.4.12
(0017419)
kresss   
2012-09-07 15:34   
Workaround by changing the function call.

$ diff ../testlink-1.9.4/lib/functions/gpc_api.php gpc_api.php
17c17
< $g_cookie_secure_flag_enabled = isset( $_SERVER['HTTPS'] ) && ( utf8_strtolower( $_SERVER['HTTPS'] ) != 'off' );
---
> $g_cookie_secure_flag_enabled = isset( $_SERVER['HTTPS'] ) && ( strtolower( $_SERVER['HTTPS'], 'UTF-8') != 'off' );
(0017420)
fman   
2012-09-07 16:51   
Problem is:
utf8_strtolower() NEEDS the mbstring extension installed.

check that you have mbstring extension installed.

(0017421)
fman   
2012-09-07 16:52   
(edited on: 2012-09-07 16:53)
Reminder sent to: kinow

You need to write some workaround (seems there are several on the net)

http://www.phpwact.org/php/i18n/charsets [^]

(0017428)
kresss   
2012-09-10 13:57   
Installed mbstring (version 5.3.3-14.el6_3) package on RHEL6.
Reverted back to original code base.
Problem persists.

Not sure where the utf8_strtolower function came from. PHP.net doesn't list it. Maybe someone wrote a wrapper around mb_strtolower?
(0017431)
kinow   
2012-09-10 15:35   
My bad, during the port of Mantis code to TestLink I forgot to include this function, that is called only when the user is using HTTPS. I'll fix that ASAP.
(0017433)
fman   
2012-09-10 16:00   
@kinow Please DO COMMIT on testlink_1_9 and master, NOT ON testlink_194
(0017434)
kinow   
2012-09-10 16:02   
@fman: okay, thanks for the heads up. I'll send the file to the user first, to confirm that my change fixes the issue and works in his environment. I'm just debugging the code and creating a test case in tlqarepo.
(0017435)
kinow   
2012-09-10 16:09   
Hi @satishk, @kresss,

I've uploaded a file with a fix for this issue. Could you guys take a look and report if it works, pleease?

I've replaced the call to the missing function to mb_strtolower, used internally by Mantis.

I've also included a test case in our TestLink test instance, so hopefully this issue won't happen again in the future, I apologize again.

After installing a self signed certificate at my local apache2, and using SSL, the fix seems to work :-)

All the best,
Bruno
(0017436)
kresss   
2012-09-10 17:34   
Worked for me. Thanks for the quick turnaround.

S.
(0017437)
kinow   
2012-09-10 17:43   
Thanks @kresss, I'll commit the code to our source repository. The mb_strtolower is compatible with PHP 4.x & 5.x, so I believe we won't have any other issues with this part of the code.
(0017438)
kinow   
2012-09-10 17:57   
@fman: committed the gpc_api.php file to testlink_1_9 and master (the login.php requires some merging)
(0017453)
satishk   
2012-09-11 19:51   
@kinow - Works for me too. Thanks for the quick fix. Much appreciated.
(0017454)
kinow   
2012-09-11 19:59   
@satishk thank you! I'm setting the issue status to resolved, it will be available in the next release. Thank you all.
(0021341)
fman   
2014-07-27 10:04   
done