Bug #54250 [NEW]: date_default_timezone_set stat()'s whole /usr/share/zoneinfo upon first call

From: Date: Mon, 14 Mar 2011 18:11:30 +0000
Subject: Bug #54250 [NEW]: date_default_timezone_set stat()'s whole /usr/share/zoneinfo upon first call
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-159467@lists.php.net to get a copy of this message
From: Operating system: Linux 2.6 PHP version: 5.3.5 Package: Date/time related Bug Type: Bug Bug description:date_default_timezone_set stat()'s whole /usr/share/zoneinfo upon first call Description: ------------ Upon first call to date_default_timezone_set, PHP syscalls stat() on all the files in /usr/share/zoneinfo. It can be easily checked by running: $ strace -s 100 -r php -n -r"date_default_timezone_set('GMT');" 2>&1 | grep zoneinfo On average Debian/Ubuntu system it accounts for little over 600 syscalls. Reproduced on: PHP 5.3.5-1 with Suhosin-Patch (cli) (built: Feb 19 2011 01:57:59) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH PHP 5.2.6-1+lenny9 with Suhosin-Patch 0.9.6.2 (cli) (built: Aug 4 2010 03:25:57) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies with Xdebug v2.0.3, Copyright (c) 2002-2007, by Derick Rethans PHP 5.3.2-1ubuntu4.7 with Suhosin-Patch (cli) (built: Jan 12 2011 18:36:08) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans *Not* reproduced on: PHP 5.3.3-0.dotdeb.1 with Suhosin-Patch (cli) (built: Oct 1 2010 08:49:29) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH Test script: --------------- $ strace -s 100 -r php -n -r"date_default_timezone_set('GMT');" 2>&1 | grep zoneinfo | head -10 0.000190 open("/usr/share/zoneinfo/", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3 0.000046 stat64("/usr/share/zoneinfo//localtime", {st_mode=S_IFREG|0644, st_size=3661, ...}) = 0 0.000112 stat64("/usr/share/zoneinfo//Zulu", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0 0.000101 stat64("/usr/share/zoneinfo//WET", {st_mode=S_IFREG|0644, st_size=1873, ...}) = 0 0.000100 stat64("/usr/share/zoneinfo//W-SU", {st_mode=S_IFREG|0644, st_size=2194, ...}) = 0 0.000098 stat64("/usr/share/zoneinfo//Universal", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0 0.000101 stat64("/usr/share/zoneinfo//UTC", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0 0.000099 stat64("/usr/share/zoneinfo//US", {st_mode=S_IFDIR|0755, st_size=352, ...}) = 0 0.000097 stat64("/usr/share/zoneinfo//UCT", {st_mode=S_IFREG|0644, st_size=118, ...}) = 0 0.000099 stat64("/usr/share/zoneinfo//Turkey", {st_mode=S_IFREG|0644, st_size=2721, ...}) = 0 $ strace -s 100 -r php -n -r"date_default_timezone_set('GMT');" 2>&1 | grep zoneinfo | wc -l 626 -- Edit bug report at http://bugs.php.net/bug.php?id=54250&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54250&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54250&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54250&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54250&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54250&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54250&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54250&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54250&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54250&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54250&r=support Expected behavior: http://bugs.php.net/fix.php?id=54250&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54250&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54250&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54250&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54250&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54250&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54250&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54250&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54250&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54250&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54250&r=mysqlcfg

« previous php.bugs (#159467) next »