diff options
| author | Dmitry Stogov <dmitry@zend.com> | 2014-03-21 15:32:02 +0400 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@zend.com> | 2014-03-21 15:32:02 +0400 |
| commit | 7ce06ee5a7a216671c40169fc3326ca3f6fd92cc (patch) | |
| tree | 1cbe9276146135a6b2af9e0d097915cb3f8ebda4 | |
| parent | ef6919e6f2ffc951b9014778f74e79c7a6fbe3eb (diff) | |
| download | php-git-7ce06ee5a7a216671c40169fc3326ca3f6fd92cc.tar.gz | |
don't keep useless objects till the end of the script (destroy them immediately)
| -rw-r--r-- | ext/date/php_date.c | 4 | ||||
| -rw-r--r-- | ext/date/tests/bug51866.phpt | 8 |
2 files changed, 8 insertions, 4 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 8c08ddba20..9070c3ba4e 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -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; } } diff --git a/ext/date/tests/bug51866.phpt b/ext/date/tests/bug51866.phpt index 8d765b02f0..01ca555fd9 100644 --- a/ext/date/tests/bug51866.phpt +++ b/ext/date/tests/bug51866.phpt @@ -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"]=> |
