]> granicus.if.org Git - php/commitdiff
don't keep useless objects till the end of the script (destroy them immediately)
authorDmitry Stogov <dmitry@zend.com>
Fri, 21 Mar 2014 11:32:02 +0000 (15:32 +0400)
committerDmitry Stogov <dmitry@zend.com>
Fri, 21 Mar 2014 11:32:02 +0000 (15:32 +0400)
ext/date/php_date.c
ext/date/tests/bug51866.phpt

index 8c08ddba20876ab1b707d7986b8a52c27af2096e..9070c3ba4e96186cf7c70939be0a55edeaf40c58 100644 (file)
@@ -2605,6 +2605,7 @@ PHP_FUNCTION(date_create)
 
        php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
        if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
+               zval_dtor(return_value);
                RETURN_FALSE;
        }
 }
@@ -2625,6 +2626,7 @@ PHP_FUNCTION(date_create_immutable)
 
        php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
        if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, NULL, timezone_object, 0 TSRMLS_CC)) {
+               zval_dtor(return_value);
                RETURN_FALSE;
        }
 }
@@ -2645,6 +2647,7 @@ PHP_FUNCTION(date_create_from_format)
 
        php_date_instantiate(date_ce_date, return_value TSRMLS_CC);
        if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
+               zval_dtor(return_value);
                RETURN_FALSE;
        }
 }
@@ -2665,6 +2668,7 @@ PHP_FUNCTION(date_create_immutable_from_format)
 
        php_date_instantiate(date_ce_immutable, return_value TSRMLS_CC);
        if (!php_date_initialize(Z_PHPDATE_P(return_value), time_str, time_str_len, format_str, timezone_object, 0 TSRMLS_CC)) {
+               zval_dtor(return_value);
                RETURN_FALSE;
        }
 }
index 8d765b02f0eb88fac78aa183d97bbcc5d6433599..01ca555fd951d24a32a2ac49a121e7d76425befa 100644 (file)
@@ -44,7 +44,7 @@ array(4) {
 
 string(6) "Y-m-d+"
 string(19) "2001-11-29 13:20:01"
-object(DateTime)#2 (3) {
+object(DateTime)#%d (3) {
   ["date"]=>
   string(19) "2001-11-29 %d:%d:%d"
   ["timezone_type"]=>
@@ -70,7 +70,7 @@ array(4) {
 
 string(7) "Y-m-d +"
 string(19) "2001-11-29 13:20:01"
-object(DateTime)#3 (3) {
+object(DateTime)#%d (3) {
   ["date"]=>
   string(19) "2001-11-29 %d:%d:%d"
   ["timezone_type"]=>
@@ -96,7 +96,7 @@ array(4) {
 
 string(6) "Y-m-d+"
 string(10) "2001-11-29"
-object(DateTime)#2 (3) {
+object(DateTime)#%d (3) {
   ["date"]=>
   string(19) "2001-11-29 %d:%d:%d"
   ["timezone_type"]=>
@@ -139,7 +139,7 @@ array(4) {
 
 string(7) "Y-m-d +"
 string(11) "2001-11-29 "
-object(DateTime)#2 (3) {
+object(DateTime)#%d (3) {
   ["date"]=>
   string(19) "2001-11-29 %d:%d:%d"
   ["timezone_type"]=>