note 123771 added to function.date-default-timezone-set

From: Date: Thu, 11 Apr 2019 19:29:19 +0000
Subject: note 123771 added to function.date-default-timezone-set
Groups: php.notes 
Request: Send a blank email to php-notes+get-210590@lists.php.net to get a copy of this message
> I'm sure I'm not the only one who is distressed by the recent default behavior change > to E_NOTICE when the timezone isn't explicitly set in the program or in .ini. You should always turn on notices and have a customer error handler that converts notices or indeed any PHP message to exceptions. I've been doing this for years and it looks like expanding the use of exceptions in PHP itself is an ongoing process. It's almost certainly stuck with notices from legacy patterns prior to PHP possessing exception capability with the reason it's not been thoroughly applied being BC breakage. Even in my extensions I redirect notices and warnings to exceptions. I'm certain the whole pressure for the ?? operator was to facilitate errors to exceptions as the only real drawback of that is needing to use isset a fair bit more. Similar for asserts, json, etc, etc it all to use exceptions. Another note. I profiled my PHP script and it reported that calling this function took half the time. Anyone else got this? Is it really that expensive? Am I doubling init time not having it in php.ini and possibly setting to the timezone it's already on? Or is it messing with time and breaking the time measurement? One day I'll bother to wrap it in microtime to try to see. ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.142 (proxied: 89.197.178.10) ---- Manual Page -- http://php.net/manual/en/function.date-default-timezone-set.php Edit -- https://master.php.net/note/edit/123771 Del: integrated -- https://master.php.net/note/delete/123771/integrated Del: useless -- https://master.php.net/note/delete/123771/useless Del: bad code -- https://master.php.net/note/delete/123771/bad+code Del: spam -- https://master.php.net/note/delete/123771/spam Del: non-english -- https://master.php.net/note/delete/123771/non-english Del: in docs -- https://master.php.net/note/delete/123771/in+docs Del: other reasons-- https://master.php.net/note/delete/123771 Reject -- https://master.php.net/note/reject/123771 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#210590) next »