Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/175907

Change subject: Use gmmktime instead of strtotime
......................................................................

Use gmmktime instead of strtotime

In MediaWiki settings are loaded before MediaWiki has normalised
the timezone in php (since one of the config vars is for timezone).

This causes warnings like:
> PHP Warning:  strtotime(): It is not safe to rely on the system's timezone
> settings. You are *required* to use the date.timezone setting or the
> date_default_timezone_set() function. Defaulting to 'UTC'.

In wmf-production, the timezone is hardcoded early on to avoid
this warning.

Change-Id: I16f7482ea92dfef8bdceb550e6b8c508cc5fa0cf
---
M CentralNotice.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice 
refs/changes/07/175907/1

diff --git a/CentralNotice.php b/CentralNotice.php
index 13b059d..5d3bd8c 100644
--- a/CentralNotice.php
+++ b/CentralNotice.php
@@ -146,7 +146,9 @@
 /**
  * @var int timestamp after which old-format 'hide' cookies are deleted
  */
-$wgNoticeOldCookieApocalypse = strtotime( '2014-11-09' );
+// Avoid strtotime( '2014-11-09' ) since settings are loaded before
+// timezone is normalised by MediaWiki (warns about date.timezone unset).
+$wgNoticeOldCookieApocalypse = gmmktime( 0, 0, 0, 11, 9, 2014 );
 
 /**
  * @var string[] $wgNoticeHideUrls Locations of Special:HideBanner targets to 
hit

-- 
To view, visit https://gerrit.wikimedia.org/r/175907
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I16f7482ea92dfef8bdceb550e6b8c508cc5fa0cf
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to