View Issue Details

IDProjectCategoryView StatusLast Update
0014009mantisbtadministrationpublic2014-09-23 18:05
Reportertimj Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.9 
Target Version1.2.13Fixed in Version1.2.13 
Summary0014009: admin/check.php fatal error on PHP 5.1.x (undefined function timezone_identifiers_list())
Description

On PHP 5.1.x, which is still the supported series of PHP on Red Hat Enterprise Linux 5 and derived distributions, the admin/check.php script crashes with:

PHP Fatal error: Call to undefined function timezone_identifiers_list() in /path/to/admin/check.php on line 364

According to http://se2.php.net/timezone_identifiers_list , this function was added only in PHP 5.2.x. Therefore, it should be conditionally called according to the PHP version, since it would be better to skip the timezone check and let the rest of the checks run.

Simple patch attached.

TagsNo tags attached.
Attached Files
mantis-bug-14009.patch (1,627 bytes)   
--- check.php.old	2012-03-04 02:32:43.000000000 +0000
+++ check.php	2012-03-06 20:10:52.000000000 +0000
@@ -357,11 +357,19 @@
 
 if ( !is_blank ( config_get_global( 'default_timezone' ) ) ) {
 	if ( print_test_row( 'Checking if a timezone is set in config.inc.php....', !is_blank ( config_get_global( 'default_timezone' ) ), config_get_global( 'default_timezone' ) ) ) {
-		print_test_row( 'Checking if timezone is valid from config.inc.php....', in_array( config_get_global( 'default_timezone' ), timezone_identifiers_list() ), config_get_global( 'default_timezone' ) );
+		if ( version_compare ( phpversion(), '5.2.0') >= 0 ) {
+			print_test_row( 'Checking if timezone is valid from config.inc.php....', in_array( config_get_global( 'default_timezone' ), timezone_identifiers_list() ), config_get_global( 'default_timezone' ) );
+		} else {
+			print_test_row( 'Checking if timezone is valid in config.inc.php....', false, 'Cannot check validity on PHP < 5.2.0');
+		}
 	}
 } else {
 	if( print_test_row( 'Checking if timezone is set in php.ini....', ini_get( 'date.timezone' ) !== '' ) ) {
-		print_test_row( 'Checking if timezone is valid in php.ini....', in_array( ini_get( 'date.timezone' ), timezone_identifiers_list() ), ini_get( 'date.timezone' ) );
+		if ( version_compare ( phpversion(), '5.2.0') >= 0 ) {
+			print_test_row( 'Checking if timezone is valid in php.ini....', in_array( ini_get( 'date.timezone' ), timezone_identifiers_list() ), ini_get( 'date.timezone' ) );
+		} else {
+			print_test_row( 'Checking if timezone is valid in php.ini....', false, 'Cannot check validity on PHP < 5.2.0');
+		}
 	}
 }
 
mantis-bug-14009.patch (1,627 bytes)   
mantis-bug-14009a.patch (1,637 bytes)   
--- check.php.old	2012-03-04 02:32:43.000000000 +0000
+++ check.php	2012-03-06 21:33:10.000000000 +0000
@@ -357,11 +357,19 @@
 
 if ( !is_blank ( config_get_global( 'default_timezone' ) ) ) {
 	if ( print_test_row( 'Checking if a timezone is set in config.inc.php....', !is_blank ( config_get_global( 'default_timezone' ) ), config_get_global( 'default_timezone' ) ) ) {
-		print_test_row( 'Checking if timezone is valid from config.inc.php....', in_array( config_get_global( 'default_timezone' ), timezone_identifiers_list() ), config_get_global( 'default_timezone' ) );
+		if ( version_compare ( phpversion(), '5.2.0') >= 0 ) {
+			print_test_row( 'Checking if timezone is valid from config.inc.php....', in_array( config_get_global( 'default_timezone' ), timezone_identifiers_list() ), config_get_global( 'default_timezone' ) );
+		} else {
+			print_test_warn_row( 'Checking if timezone is valid in config.inc.php....', false, 'Cannot check validity on PHP < 5.2.0');
+		}
 	}
 } else {
 	if( print_test_row( 'Checking if timezone is set in php.ini....', ini_get( 'date.timezone' ) !== '' ) ) {
-		print_test_row( 'Checking if timezone is valid in php.ini....', in_array( ini_get( 'date.timezone' ), timezone_identifiers_list() ), ini_get( 'date.timezone' ) );
+		if ( version_compare ( phpversion(), '5.2.0') >= 0 ) {
+			print_test_row( 'Checking if timezone is valid in php.ini....', in_array( ini_get( 'date.timezone' ), timezone_identifiers_list() ), ini_get( 'date.timezone' ) );
+		} else {
+			print_test_warn_row( 'Checking if timezone is valid in php.ini....', false, 'Cannot check validity on PHP < 5.2.0');
+		}
 	}
 }
 
mantis-bug-14009a.patch (1,637 bytes)   

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
related to 0016544 closeddregad Help! I cann't choose timezone 

Activities

timj

timj

2012-03-06 16:35

reporter   ~0031391

Updated patch that just warns instead of showing an error ("BAD") attached.

dregad

dregad

2012-11-14 10:57

developer   ~0034314

Hi Tim,

Thanks for reporting this issue and for the proposed patch. I have applied an improved version of your fix, which will be released in the next version of MantisBT. Feel free to download a nightly build starting tomorrow, and reopen this issue if you still notice any issues (I don't have any PHP 5.1 platform available for testing)

grangeway

grangeway

2013-04-05 17:56

reporter   ~0036118

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master-1.2.x c513054c

2012-11-14 08:18

dregad


Details Diff
Fix and improve timezone verification in admin checks

admin/check.php now properly detects issues with timezone settings, in
line with behavior of date_default_timezone_get() in PHP >= 5.3 and
provides better information to the admin in case of errors.

It also fixes an issue with PHP 5.1, by only calling function
timezone_identifiers_list() when it actually exists, and returns a
warning that it is unable to check timezone if it does not. Thanks to
Tim Jackson for detecting and providing the initial patch for this bug.

Fixes 0014009
Affected Issues
0014009
mod - admin/check.php Diff File
mod - core.php Diff File

MantisBT: master 12da98b1

2012-11-14 10:42

dregad


Details Diff
Fix initialization of default timezone in core.php

Fixes #14084, see also related issue 0014009 for 1.2.x branch
Affected Issues
0014009
mod - core.php Diff File