[prev in list] [next in list] [prev in thread] [next in thread]
List: php-cvs
Subject: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/date php_date.c php_date.h
From: "Stanislav Malyshev" <stas () php ! net>
Date: 2009-05-31 21:28:38
Message-ID: cvsstas1243805318 () cvsserver
[Download RAW message or body]
stas Sun May 31 21:28:38 2009 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/date php_date.c php_date.h
Log:
fix for #48247
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.c?r1=1.43.2.45.2.51.2.77&r2=1.43.2.45.2.51.2.78&diff_format=u
Index: php-src/ext/date/php_date.c
diff -u php-src/ext/date/php_date.c:1.43.2.45.2.51.2.77 \
php-src/ext/date/php_date.c:1.43.2.45.2.51.2.78
--- php-src/ext/date/php_date.c:1.43.2.45.2.51.2.77 Tue May 19 19:23:33 2009
+++ php-src/ext/date/php_date.c Sun May 31 21:28:38 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.c,v 1.43.2.45.2.51.2.77 2009/05/19 19:23:33 bjori Exp $ */
+/* $Id: php_date.c,v 1.43.2.45.2.51.2.78 2009/05/31 21:28:38 stas Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -590,6 +590,7 @@
{
date_globals->default_timezone = NULL;
date_globals->timezone = NULL;
+ date_globals->tzcache = NULL;
}
/* }}} */
@@ -608,7 +609,7 @@
efree(DATEG(timezone));
}
DATEG(timezone) = NULL;
- zend_hash_init(&DATEG(tzcache), 4, NULL, _php_date_tzinfo_dtor, 0);
+ DATEG(tzcache) = NULL;
return SUCCESS;
}
@@ -621,8 +622,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;
}
/* }}} */
@@ -804,13 +808,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;
}
@@ -906,7 +915,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) {
http://cvs.php.net/viewvc.cgi/php-src/ext/date/php_date.h?r1=1.17.2.11.2.3.2.12&r2=1.17.2.11.2.3.2.13&diff_format=u
Index: php-src/ext/date/php_date.h
diff -u php-src/ext/date/php_date.h:1.17.2.11.2.3.2.12 \
php-src/ext/date/php_date.h:1.17.2.11.2.3.2.13
--- php-src/ext/date/php_date.h:1.17.2.11.2.3.2.12 Sun May 3 19:58:49 2009
+++ php-src/ext/date/php_date.h Sun May 31 21:28:38 2009
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_date.h,v 1.17.2.11.2.3.2.12 2009/05/03 19:58:49 derick Exp $ */
+/* $Id: php_date.h,v 1.17.2.11.2.3.2.13 2009/05/31 21:28:38 stas Exp $ */
#ifndef PHP_DATE_H
#define PHP_DATE_H
@@ -149,7 +149,7 @@
ZEND_BEGIN_MODULE_GLOBALS(date)
char *default_timezone;
char *timezone;
- HashTable tzcache;
+ HashTable *tzcache;
timelib_error_container *last_errors;
ZEND_END_MODULE_GLOBALS(date)
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic