ID: 47285 Comment by: martin at 925 dot dk Reported By: danger at FreeBSD dot org Status: Assigned Bug Type: Date/time related Operating System: FreeBSD PHP Version: 5.2.8 Assigned To: derick New Comment:
Removing UTC from the timestamp in php_date.c also fixes the leak: --- php_date_.c 2009-03-09 22:30:15.000000000 +0100 +++ php_date.c 2009-03-09 22:30:21.000000000 +0100 @@ -1117,7 +1117,7 @@ now = timelib_time_ctor(); initial_ts = emalloc(25); - snprintf(initial_ts, 24, "@%ld UTC", preset_ts); + snprintf(initial_ts, 24, "@%ld", preset_ts); t = timelib_strtotime(initial_ts, strlen(initial_ts), NULL, DATE_TIMEZONEDB); /* we ignore the error here, as this should never fail */ timelib_update_ts(t, tzi); now->tz_info = tzi; Previous Comments: ------------------------------------------------------------------------ [2009-03-09 18:46:22] martin at 925 dot dk This patch (which reverts the fix for bug 45529) against parse_date.c seems to fix the leak: Hence this patch against parse_date.c: --- parse_date_.c 2009-03-09 19:33:37.000000000 +0100 +++ parse_date.c 2009-03-09 19:33:45.000000000 +0100 @@ -733,7 +733,7 @@ } #endif /* If we have a TimeZone identifier to start with, use it */ - if (strstr(tz_abbr, "/") || strcmp(tz_abbr, "UTC") == 0) { + if (strstr(tz_abbr, "/")) { if ((res = timelib_parse_tzfile(tz_abbr, tzdb)) != NULL) { t->tz_info = res; t->zone_type = TIMELIB_ZONETYPE_ID; ------------------------------------------------------------------------ [2009-02-27 14:48:14] maarten at vivesta dot com Same here. I've added a date_default_timezone_set() before using strtotime() and it removed the error but not the leak. ------------------------------------------------------------------------ [2009-02-27 13:53:29] danger at FreeBSD dot org I tried to run my script with php -d error_reporting=E_STRICT test.php and been receiving this error until I stopped the script: Strict Standards: strtotime(): It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CET/1.0/no DST' instead in /root/test.php on line 10 ------------------------------------------------------------------------ [2009-02-27 13:25:37] danger at FreeBSD dot org Hey there, I have tried to build a stock php-5.2.9 (no FreeBSD patches or anything else) with ./configure && make. When I run my test script as this: r...@[temp /var/ports/distfiles/php-5.2.9]# sapi/cli/php /root/test.php No modified php.ini is being used, no additional extensions are being loaded. I can still verify that it leaks. ------------------------------------------------------------------------ [2009-02-27 11:44:35] der...@php.net I am not forgetting about this, but at the moment just really occupied. Just as a quick question, this is the *stock* PHP without any ports patches, also, if you set the error level to also show e_Strict messages, do you see anything? Also, do you have the date.timezone setting made in PHP.ini? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/47285 -- Edit this bug report at http://bugs.php.net/?id=47285&edit=1