- Fixed bug #47516 (nowdoc can not be embed in heredoc but can be embed in
double quote). (Dmitry)
- Fixed bug #47038 (Memory leak in include). (Dmitry)
+- Fixed bug #46108 (DateTime - Memory leak when unserializing). (Felipe)
- Fixed bug #44861 (scrollable cursor don't work with pgsql). (Matteo)
- Fixed bug #44409 (PDO::FETCH_SERIALIZE calls __construct()). (Matteo)
- Fixed bug #44173 (PDO->query() parameter parsing/checking needs an
/* Advanced Interface */
static zval * date_instantiate(zend_class_entry *pce, zval *object TSRMLS_DC)
{
- if (!object) {
- ALLOC_ZVAL(object);
- }
-
Z_TYPE_P(object) = IS_OBJECT;
object_init_ex(object, pce);
Z_SET_REFCOUNT_P(object, 1);
tzi = php_date_parse_tzfile(Z_STRVAL_PP(z_timezone), DATE_TIMEZONEDB TSRMLS_CC);
+ ALLOC_INIT_ZVAL(tmp_obj);
tzobj = zend_object_store_get_object(date_instantiate(date_ce_timezone, tmp_obj TSRMLS_CC) TSRMLS_CC);
tzobj->type = TIMELIB_ZONETYPE_ID;
tzobj->tzi.tz = tzi;
tzobj->initialized = 1;
date_initialize(*dateobj, Z_STRVAL_PP(z_date), Z_STRLEN_PP(z_date), NULL, tmp_obj, 0 TSRMLS_CC);
+ zval_ptr_dtor(&tmp_obj);
return 1;
}
}
--- /dev/null
+--TEST--
+Bug #46108 (DateTime - Memory leak when unserializing)
+--FILE--
+<?php
+
+date_default_timezone_set('America/Sao_Paulo');
+
+var_dump(unserialize(serialize(new Datetime)));
+
+?>
+--EXPECTF--
+object(DateTime)#%d (3) {
+ [%u|b%"date"]=>
+ %string|unicode%(%d) "%s"
+ [%u|b%"timezone_type"]=>
+ int(%d)
+ [%u|b%"timezone"]=>
+ %string|unicode%(%d) "America/Sao_Paulo"
+}