diff options
| -rw-r--r-- | .gdbinit | 4 | ||||
| -rw-r--r-- | Zend/tests/incdec_ref_property.phpt | 27 | ||||
| -rw-r--r-- | Zend/tests/line_const_in_array.phpt | 21 | ||||
| -rw-r--r-- | Zend/zend.c | 2 | ||||
| -rw-r--r-- | Zend/zend_API.c | 2 | ||||
| -rw-r--r-- | Zend/zend_API.h | 2 | ||||
| -rw-r--r-- | Zend/zend_compile.c | 2 | ||||
| -rw-r--r-- | Zend/zend_extensions.h | 2 | ||||
| -rw-r--r-- | Zend/zend_vm_def.h | 10 | ||||
| -rw-r--r-- | Zend/zend_vm_execute.h | 120 | ||||
| -rw-r--r-- | ext/dom/php_dom.c | 21 | ||||
| -rw-r--r-- | ext/dom/tests/bug67949.phpt | 32 | ||||
| -rw-r--r-- | ext/json/json.c | 2 | ||||
| -rw-r--r-- | ext/opcache/Optimizer/pass1_5.c | 6 | ||||
| -rw-r--r-- | ext/reflection/php_reflection.c | 6 | ||||
| -rw-r--r-- | ext/spl/spl_dllist.c | 8 |
16 files changed, 168 insertions, 99 deletions
@@ -53,11 +53,11 @@ define dump_bt printf "[%p] ", $ex set $func = $ex->func if $func - if $ex->object + if $ex->This->value.obj if $func->common.scope printf "%s->", $func->common.scope->name->val else - printf "%s->", $ex->object->ce.name->val + printf "%s->", $ex->This->value.obj->ce.name->val end else if $func->common.scope diff --git a/Zend/tests/incdec_ref_property.phpt b/Zend/tests/incdec_ref_property.phpt new file mode 100644 index 0000000000..a73b2912ab --- /dev/null +++ b/Zend/tests/incdec_ref_property.phpt @@ -0,0 +1,27 @@ +--TEST-- +Incrementing and decrementing a referenced property +--FILE-- +<?php + +$obj = new stdClass; +$obj->prop = 1; +$ref =& $obj->prop; +var_dump(++$obj->prop); +var_dump($obj->prop); +var_dump($obj->prop++); +var_dump($obj->prop); +var_dump(--$obj->prop); +var_dump($obj->prop); +var_dump($obj->prop--); +var_dump($obj->prop); + +?> +--EXPECT-- +int(2) +int(2) +int(2) +int(3) +int(2) +int(2) +int(2) +int(1) diff --git a/Zend/tests/line_const_in_array.phpt b/Zend/tests/line_const_in_array.phpt new file mode 100644 index 0000000000..181f67e3da --- /dev/null +++ b/Zend/tests/line_const_in_array.phpt @@ -0,0 +1,21 @@ +--TEST-- +Use of __LINE__ in arrays +--FILE-- +<?php + +var_dump([ + __LINE__, + __LINE__, + __LINE__, +]); + +?> +--EXPECT-- +array(3) { + [0]=> + int(4) + [1]=> + int(5) + [2]=> + int(6) +} diff --git a/Zend/zend.c b/Zend/zend.c index a7d3bc156e..8c10125fe3 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -822,7 +822,7 @@ ZEND_API void _zend_bailout(char *filename, uint lineno) /* {{{ */ /* }}} */ END_EXTERN_C() -void zend_append_version_info(const zend_extension *extension) /* {{{ */ +ZEND_API void zend_append_version_info(const zend_extension *extension) /* {{{ */ { char *new_info; uint new_info_length; diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 5fa509bc6f..632d4a4ebe 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2619,7 +2619,7 @@ ZEND_API void zend_post_deactivate_modules(TSRMLS_D) /* {{{ */ /* }}} */ /* return the next free module number */ -int zend_next_free_module(void) /* {{{ */ +ZEND_API int zend_next_free_module(void) /* {{{ */ { return zend_hash_num_elements(&module_registry) + 1; } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index b73dcd4c65..b23b5b32f0 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -229,7 +229,7 @@ typedef struct _zend_fcall_info_cache { #define ZEND_FCI_INITIALIZED(fci) ((fci).size != 0) -int zend_next_free_module(void); +ZEND_API int zend_next_free_module(void); BEGIN_EXTERN_C() ZEND_API int zend_get_parameters(int ht, int param_count, ...); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ded71481db..08d2ee1502 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -4915,7 +4915,7 @@ static zend_bool zend_try_ct_eval_magic_const(zval *zv, zend_ast *ast TSRMLS_DC) switch (ast->attr) { case T_LINE: - ZVAL_LONG(zv, CG(zend_lineno)); + ZVAL_LONG(zv, ast->lineno); break; case T_FILE: ZVAL_STR_COPY(zv, CG(compiled_filename)); diff --git a/Zend/zend_extensions.h b/Zend/zend_extensions.h index e210839870..792a8a6164 100644 --- a/Zend/zend_extensions.h +++ b/Zend/zend_extensions.h @@ -111,7 +111,7 @@ END_EXTERN_C() ZEND_API extern zend_llist zend_extensions; void zend_extension_dtor(zend_extension *extension); -void zend_append_version_info(const zend_extension *extension); +ZEND_API void zend_append_version_info(const zend_extension *extension); int zend_startup_extensions_mechanism(void); int zend_startup_extensions(void); void zend_shutdown_extensions(TSRMLS_D); diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 736ce178d6..091b384c33 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -719,7 +719,8 @@ ZEND_VM_HELPER_EX(zend_pre_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR| if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -812,12 +813,11 @@ ZEND_VM_HELPER_EX(zend_post_incdec_property_helper, VAR|UNUSED|CV, CONST|TMP|VAR zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((OP2_TYPE == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index af0cd96bbf..9f8be5ceb0 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -17918,7 +17918,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CONST(incdec_t if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -18010,12 +18011,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CONST(incdec_ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -20356,7 +20356,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_TMP(incdec_t i if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -20449,12 +20450,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_TMP(incdec_t zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -22368,7 +22368,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_VAR(incdec_t i if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -22461,12 +22462,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_VAR(incdec_t zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -25946,7 +25946,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_VAR_CV(incdec_t in if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -26038,12 +26039,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_VAR_CV(incdec_t i zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -27815,7 +27815,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CONST(incde if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -27907,12 +27908,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CONST(incd zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -29206,7 +29206,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_TMP(incdec_ if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -29299,12 +29300,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_TMP(incdec zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -30514,7 +30514,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_VAR(incdec_ if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -30607,12 +30608,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_VAR(incdec zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -32340,7 +32340,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_UNUSED_CV(incdec_t if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -32432,12 +32433,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_UNUSED_CV(incdec_ zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -35321,7 +35321,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CONST(incdec_t if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -35413,12 +35414,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CONST(incdec_t zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CONST == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -37592,7 +37592,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_TMP(incdec_t in if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -37685,12 +37686,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_TMP(incdec_t i zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_TMP_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -39476,7 +39476,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_VAR(incdec_t in if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -39569,12 +39570,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_VAR(incdec_t i zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_VAR == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } @@ -42781,7 +42781,8 @@ static int ZEND_FASTCALL zend_pre_incdec_property_helper_SPEC_CV_CV(incdec_t inc if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) { zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ - SEPARATE_ZVAL_IF_NOT_REF(zptr); + ZVAL_DEREF(zptr); + SEPARATE_ZVAL_NOREF(zptr); have_get_ptr = 1; incdec_op(zptr); @@ -42873,12 +42874,11 @@ static int ZEND_FASTCALL zend_post_incdec_property_helper_SPEC_CV_CV(incdec_t in zval *zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property, BP_VAR_RW, ((IS_CV == IS_CONST) ? (EX(run_time_cache) + Z_CACHE_SLOT_P(property)) : NULL) TSRMLS_CC); if (zptr != NULL) { /* NULL means no success in getting PTR */ have_get_ptr = 1; - SEPARATE_ZVAL_IF_NOT_REF(zptr); - - ZVAL_DUP(retval, zptr); + ZVAL_DEREF(zptr); + ZVAL_COPY(retval, zptr); + SEPARATE_ZVAL_NOREF(zptr); incdec_op(zptr); - } } diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 71c06612db..c25cbaba58 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -1552,8 +1552,7 @@ zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv return NULL; } - ZVAL_COPY(&offset_copy, offset); - convert_to_long(&offset_copy); + ZVAL_LONG(&offset_copy, zval_get_long(offset)); zend_call_method_with_1_params(object, Z_OBJCE_P(object), NULL, "item", rv, &offset_copy); @@ -1562,21 +1561,15 @@ zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty TSRMLS_DC) { - zval *length, offset_copy; - int ret; - - ZVAL_COPY(&offset_copy, member); - convert_to_long(&offset_copy); + zend_long offset = zval_get_long(member); - if (Z_LVAL(offset_copy) < 0) { + if (offset < 0) { return 0; - } - - length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0 TSRMLS_CC); - - ret = Z_LVAL(offset_copy) < Z_LVAL_P(length); + } else { + zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0 TSRMLS_CC); - return ret; + return length && offset < Z_LVAL_P(length); + } } /* }}} end dom_nodelist_has_dimension */ #endif /* HAVE_DOM */ diff --git a/ext/dom/tests/bug67949.phpt b/ext/dom/tests/bug67949.phpt index fc29881ca7..e4eb6f724f 100644 --- a/ext/dom/tests/bug67949.phpt +++ b/ext/dom/tests/bug67949.phpt @@ -22,11 +22,21 @@ var_dump($nodes[0]->textContent); var_dump($nodes[1]->textContent); echo "testing offset not a long\n"; -$offset = 'test'; +$offset = ['test']; +var_dump($offset); +var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent); +var_dump($offset); + +$something = 'test'; +$offset = &$something; + +var_dump($offset); +var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent); var_dump($offset); -var_dump($nodes[$offset]->textContent); + +$offset = 'test'; var_dump($offset); -var_dump(isset($nodes[$offset])); +var_dump(isset($nodes[$offset]), $nodes[$offset]->textContent); var_dump($offset); echo "testing read_dimension with null offset\n"; @@ -49,13 +59,29 @@ string(4) "data" Notice: Trying to get property of non-object in %s on line %d NULL testing offset not a long +array(1) { + [0]=> + string(4) "test" +} + +Notice: Trying to get property of non-object in %s on line %d +bool(false) +NULL +array(1) { + [0]=> + string(4) "test" +} string(4) "test" +bool(true) string(4) "data" string(4) "test" +string(4) "test" bool(true) +string(4) "data" string(4) "test" testing read_dimension with null offset NULL testing attribute access string(4) "href" ==DONE== + diff --git a/ext/json/json.c b/ext/json/json.c index 16e452a004..8f4f281ef1 100644 --- a/ext/json/json.c +++ b/ext/json/json.c @@ -571,7 +571,7 @@ static void json_encode_serializable_object(smart_str *buf, zval *val, int optio ZVAL_STRING(&fname, "jsonSerialize"); if (FAILURE == call_user_function_ex(EG(function_table), val, &fname, &retval, 0, NULL, 1, NULL TSRMLS_CC) || Z_TYPE(retval) == IS_UNDEF) { - zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name); + zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Failed calling %s::jsonSerialize()", ce->name->val); smart_str_appendl(buf, "null", sizeof("null") - 1); zval_ptr_dtor(&fname); return; diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c index f06f5cc559..b91ac5b50f 100644 --- a/ext/opcache/Optimizer/pass1_5.c +++ b/ext/opcache/Optimizer/pass1_5.c @@ -266,6 +266,9 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML break; } } + if (Z_TYPE(c) == IS_CONSTANT_AST) { + break; + } literal_dtor(&ZEND_OP2_LITERAL(opline)); MAKE_NOP(opline); zend_optimizer_replace_by_const(op_array, opline, IS_TMP_VAR, tv, &c TSRMLS_CC); @@ -312,6 +315,9 @@ void zend_optimizer_pass1(zend_op_array *op_array, zend_optimizer_ctx *ctx TSRML if ((c = zend_hash_find(&ce->constants_table, Z_STR(ZEND_OP2_LITERAL(opline)))) != NULL) { ZVAL_DEREF(c); + if (Z_TYPE_P(c) == IS_CONSTANT_AST) { + break; + } if (ZEND_IS_CONSTANT_TYPE(Z_TYPE_P(c))) { if (!zend_optimizer_get_persistent_constant(Z_STR_P(c), &t, 1 TSRMLS_CC) || ZEND_IS_CONSTANT_TYPE(Z_TYPE(t))) { diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 7291d64213..57e11945c1 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -2402,7 +2402,7 @@ ZEND_METHOD(reflection_parameter, getClass) } else { zend_string *name = zend_string_init(param->arg_info->class_name, param->arg_info->class_name_len, 0); ce = zend_lookup_class(name TSRMLS_CC); - zend_string_free(name); + zend_string_release(name); if (!ce) { zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC, "Class %s does not exist", param->arg_info->class_name); @@ -3862,10 +3862,10 @@ ZEND_METHOD(reflection_class, getProperty) if (!EG(exception)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Class %s does not exist", classname->val); } - zend_string_free(classname); + zend_string_release(classname); return; } - zend_string_free(classname); + zend_string_release(classname); if (!instanceof_function(ce, ce2 TSRMLS_CC)) { zend_throw_exception_ex(reflection_exception_ptr, -1 TSRMLS_CC, "Fully qualified property name %s::%s does not specify a base class of %s", ce2->name->val, str_name, ce->name->val); diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c index 0a6f97c563..945f7c7ab4 100644 --- a/ext/spl/spl_dllist.c +++ b/ext/spl/spl_dllist.c @@ -86,7 +86,6 @@ struct _spl_dllist_object { spl_ptr_llist *llist; int traverse_position; spl_ptr_llist_element *traverse_pointer; - zval retval; int flags; zend_function *fptr_offset_get; zend_function *fptr_offset_set; @@ -358,7 +357,6 @@ static void spl_dllist_object_free_storage(zend_object *object TSRMLS_DC) /* {{{ spl_ptr_llist_destroy(intern->llist TSRMLS_CC); SPL_LLIST_CHECK_DELREF(intern->traverse_pointer); - zval_ptr_dtor(&intern->retval); if (intern->debug_info != NULL) { zend_hash_destroy(intern->debug_info); @@ -482,10 +480,8 @@ static int spl_dllist_object_count_elements(zval *object, zend_long *count TSRML zval rv; zend_call_method_with_0_params(object, intern->std.ce, &intern->fptr_count, "count", &rv); if (!Z_ISUNDEF(rv)) { - zval_ptr_dtor(&intern->retval); - ZVAL_ZVAL(&intern->retval, &rv, 0, 0); - convert_to_long(&intern->retval); - *count = (zend_long) Z_LVAL(intern->retval); + *count = zval_get_long(&rv); + zval_ptr_dtor(&rv); return SUCCESS; } *count = 0; |
