Hi!
No, it's not fixed. Just needs some infinite recursion protection plus moving the (or rather adding it also) init of tzcache into GINIT.
Attached is the patch that seems to do the trick for me. Any objections? -- Stanislav Malyshev, Zend Software Architect s...@zend.com http://www.zend.com/ (408)253-8829 MSN: s...@zend.com
Index: php_date.c =================================================================== RCS file: /repository/php-src/ext/date/php_date.c,v retrieving revision 1.43.2.45.2.69 diff -u -r1.43.2.45.2.69 php_date.c --- php_date.c 19 May 2009 15:37:38 -0000 1.43.2.45.2.69 +++ php_date.c 29 May 2009 00:57:34 -0000 @@ -343,6 +343,7 @@ { date_globals->default_timezone = NULL; date_globals->timezone = NULL; + date_globals->tzcache = NULL; } /* }}} */ @@ -361,7 +362,7 @@ efree(DATEG(timezone)); } DATEG(timezone) = NULL; - zend_hash_init(&DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0); + DATEG(tzcache) = NULL; return SUCCESS; } @@ -374,8 +375,11 @@ efree(DATEG(timezone)); } DATEG(timezone) = NULL; - zend_hash_destroy(&DATEG(tzcache)); - + if(DATEG(tzcache)) { + zend_hash_destroy(DATEG(tzcache)); + FREE_HASHTABLE(DATEG(tzcache)); + DATEG(tzcache) = NULL; + } return SUCCESS; } /* }}} */ @@ -552,13 +556,18 @@ { timelib_tzinfo *tzi, **ptzi; - if (zend_hash_find(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) { + if(!DATEG(tzcache)) { + ALLOC_HASHTABLE(DATEG(tzcache)); + zend_hash_init(DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0); + } + + if (zend_hash_find(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void **) &ptzi) == SUCCESS) { return *ptzi; } tzi = timelib_parse_tzfile(formal_tzname, tzdb); if (tzi) { - zend_hash_add(&DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL); + zend_hash_add(DATEG(tzcache), formal_tzname, strlen(formal_tzname) + 1, (void *) &tzi, sizeof(timelib_tzinfo*), NULL); } return tzi; } @@ -654,7 +663,7 @@ { char *tz; timelib_tzinfo *tzi; - + tz = guess_timezone(DATE_TIMEZONEDB TSRMLS_CC); tzi = php_date_parse_tzfile(tz, DATE_TIMEZONEDB TSRMLS_CC); if (! tzi) { Index: php_date.h =================================================================== RCS file: /repository/php-src/ext/date/php_date.h,v retrieving revision 1.17.2.11.2.5 diff -u -r1.17.2.11.2.5 php_date.h --- php_date.h 31 Dec 2008 11:17:36 -0000 1.17.2.11.2.5 +++ php_date.h 29 May 2009 00:57:34 -0000 @@ -87,7 +87,7 @@ ZEND_BEGIN_MODULE_GLOBALS(date) char *default_timezone; char *timezone; - HashTable tzcache; + HashTable *tzcache; ZEND_END_MODULE_GLOBALS(date) #ifdef ZTS
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php