From 2e0be64b93ebf3a6abb156969c359c2691fd2cc4 Mon Sep 17 00:00:00 2001 From: Reedy Date: Mon, 20 Aug 2012 23:41:18 +0100 Subject: [PATCH] Bug 39516 - Call to a member function format() on a non-object Workaround for php bug [1], reported in 5.3.2, fixed already Workaround can be removed when our minimum PHP version is > 5.3.2 [1] https://bugs.php.net/bug.php?id=52063 Change-Id: Ia60e64300787d0b683829765e8eeac1535e9d0a4 --- includes/GlobalFunctions.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index c592c7ca92..391d11de2d 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -979,7 +979,13 @@ function wfLogDBError( $text ) { $logDBErrorTimeZoneObject = new DateTimeZone( $wgDBerrorLogTZ ); } - $d = date_create( "now", $logDBErrorTimeZoneObject ); + // Workaround for https://bugs.php.net/bug.php?id=52063 + // Can be removed when min PHP > 5.3.2 + if ( $logDBErrorTimeZoneObject === null ) { + $d = date_create( "now" ); + } else { + $d = date_create( "now", $logDBErrorTimeZoneObject ); + } $date = $d->format( 'D M j G:i:s T Y' ); -- 2.20.1