diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-05-08 15:28:57 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-05-08 15:28:57 +0300 |
commit | 9565075cbd57f226c77745f5e7c915635680784c (patch) | |
tree | ff0f8f19cdd3d55424234558f9c9792b03dc489a | |
parent | a48ade17db7bb513e012c2f2d1f746e6a472b6cb (diff) | |
download | php-git-9565075cbd57f226c77745f5e7c915635680784c.tar.gz |
Destroy function arguments in direct order
-rw-r--r-- | Zend/zend_execute.h | 11 | ||||
-rw-r--r-- | ext/date/tests/bug53437.phpt | 18 |
2 files changed, 14 insertions, 15 deletions
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h index 67bac91dd7..42f289568c 100644 --- a/Zend/zend_execute.h +++ b/Zend/zend_execute.h @@ -226,9 +226,8 @@ static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_in { if (UNEXPECTED(call_info & ZEND_CALL_FREE_EXTRA_ARGS)) { uint32_t count = ZEND_CALL_NUM_ARGS(call) - call->func->op_array.num_args; - zval *p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T + count); + zval *p = ZEND_CALL_VAR_NUM(call, call->func->op_array.last_var + call->func->op_array.T); do { - p--; if (Z_REFCOUNTED_P(p)) { zend_refcounted *r = Z_COUNTED_P(p); if (!GC_DELREF(r)) { @@ -238,6 +237,7 @@ static zend_always_inline void zend_vm_stack_free_extra_args_ex(uint32_t call_in gc_check_possible_root(r); } } + p++; } while (--count); } } @@ -252,11 +252,9 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call) uint32_t num_args = ZEND_CALL_NUM_ARGS(call); if (EXPECTED(num_args > 0)) { - zval *end = ZEND_CALL_ARG(call, 1); - zval *p = end + num_args; + zval *p = ZEND_CALL_ARG(call, 1); do { - p--; if (Z_REFCOUNTED_P(p)) { zend_refcounted *r = Z_COUNTED_P(p); if (!GC_DELREF(r)) { @@ -264,7 +262,8 @@ static zend_always_inline void zend_vm_stack_free_args(zend_execute_data *call) zval_dtor_func(r); } } - } while (p != end); + p++; + } while (--num_args); } } diff --git a/ext/date/tests/bug53437.phpt b/ext/date/tests/bug53437.phpt index 0be9691a14..3e5899057d 100644 --- a/ext/date/tests/bug53437.phpt +++ b/ext/date/tests/bug53437.phpt @@ -23,15 +23,15 @@ foreach($dpu as $dt) { } ?> ==DONE== ---EXPECT-- +--EXPECTF-- Original: 2010-01-01 00:00:00 2010-01-02 00:00:00 2010-01-03 00:00:00 -object(DatePeriod)#1 (6) { +object(DatePeriod)#%d (6) { ["start"]=> - object(DateTime)#2 (3) { + object(DateTime)#%d (3) { ["date"]=> string(26) "2010-01-01 00:00:00.000000" ["timezone_type"]=> @@ -40,7 +40,7 @@ object(DatePeriod)#1 (6) { string(3) "UTC" } ["current"]=> - object(DateTime)#4 (3) { + object(DateTime)#%d (3) { ["date"]=> string(26) "2010-01-04 00:00:00.000000" ["timezone_type"]=> @@ -51,7 +51,7 @@ object(DatePeriod)#1 (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#5 (16) { + object(DateInterval)#%d (16) { ["y"]=> int(0) ["m"]=> @@ -90,9 +90,9 @@ object(DatePeriod)#1 (6) { ["include_start_date"]=> bool(true) } -object(DatePeriod)#5 (6) { +object(DatePeriod)#%d (6) { ["start"]=> - object(DateTime)#10 (3) { + object(DateTime)#%d (3) { ["date"]=> string(26) "2010-01-01 00:00:00.000000" ["timezone_type"]=> @@ -101,7 +101,7 @@ object(DatePeriod)#5 (6) { string(3) "UTC" } ["current"]=> - object(DateTime)#7 (3) { + object(DateTime)#%d (3) { ["date"]=> string(26) "2010-01-04 00:00:00.000000" ["timezone_type"]=> @@ -112,7 +112,7 @@ object(DatePeriod)#5 (6) { ["end"]=> NULL ["interval"]=> - object(DateInterval)#8 (16) { + object(DateInterval)#%d (16) { ["y"]=> int(0) ["m"]=> |