From: njaguar at gmail dot com Operating system: * PHP version: 5.4Git-2013-01-08 (snap) Package: Performance problem Bug Type: Bug Bug description:Date timezone code-cleanup
Description: ------------ Per discussion with suggestions from Nuno Lopes, did some code cleanup over bug/patch https://bugs.php.net/bug.php?id=63699 Removed int for checked timezone, and also opting for a singular variable (timzeone) that is checked and set as appropriate. Simplifies code guess_timezone(). Minor speed increases (due to less if/checks from original code): date : 1.143 sec strftime : 0.961 sec strtotime : 2.166 sec (also re: Christopher Jones) Test script: --------------- <?php // test script to verify all is working as intended, and throws errors accordingly. Change php.ini date.timezone value to invalid setting to test that ed(); ini_set('date.timezone', 'FAKE_TIMEZONE'); ed(); ini_set('date.timezone', 'America/Chicago'); ed(); date_default_timezone_set('FAKE_TIMEZONE'); ed(); date_default_timezone_set('America/Los_Angeles'); ed(); function ed() { echo date('F j, Y, g:i a : e') . ' : ' . date_default_timezone_get() .' : ' . ini_get('date.timezone') ."<br>\n"; } ?> Expected result: ---------------- > php ~paul/test_date.php January 8, 2013, 9:58 am : America/Chicago : America/Chicago : America/Chicago<br> PHP Warning: ini_set(): Invalid date.timezone value 'FAKE_TIMEZONE'. in /home/paul/test_date.php on line 5 Warning: ini_set(): Invalid date.timezone value 'FAKE_TIMEZONE'. in /home/paul/test_date.php on line 5 January 8, 2013, 9:58 am : America/Chicago : America/Chicago : FAKE_TIMEZONE<br> January 8, 2013, 9:58 am : America/Chicago : America/Chicago : America/Chicago<br> PHP Notice: date_default_timezone_set(): Timezone ID 'FAKE_TIMEZONE' is invalid in /home/paul/test_date.php on line 11 Notice: date_default_timezone_set(): Timezone ID 'FAKE_TIMEZONE' is invalid in /home/paul/test_date.php on line 11 January 8, 2013, 9:58 am : America/Chicago : America/Chicago : America/Chicago<br> January 8, 2013, 7:58 am : America/Los_Angeles : America/Los_Angeles : America/Chicago<br> Actual result: -------------- n/a -- Edit bug report at https://bugs.php.net/bug.php?id=63941&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63941&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63941&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63941&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63941&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63941&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63941&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63941&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63941&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63941&r=support Expected behavior: https://bugs.php.net/fix.php?id=63941&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63941&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63941&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63941&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63941&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63941&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63941&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63941&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63941&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63941&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63941&r=mysqlcfg