From: Reedy Date: Mon, 20 Aug 2012 22:41:18 +0000 (+0100) Subject: Bug 39516 - Call to a member function format() on a non-object X-Git-Tag: 1.31.0-rc.0~22661^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/voir.php?a=commitdiff_plain;h=2e0be64b93ebf3a6abb156969c359c2691fd2cc4;p=lhc%2Fweb%2Fwiklou.git 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 --- 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' );