com php-src: Merge branch 'master' of https://github.com/php/php-src into typed-properties: Zend/zend_API.c Zend/zend_API.h Z end/zend_ast.c
Zend/zend_compile.c Zend/zend_comp ile.h Zend/zend_execute.c Zend/zend_execute.h Z end/zend_execute_API.c Zend/zend_inheritance.c Ze
nd/zend_language_parser.y Zend/zend_vm_def.h Ze nd/zend_vm_execute.h ext/reflection/php_reflection. c

From: Date: Tue, 05 Apr 2016 05:55:27 +0000
Subject: com php-src: Merge branch 'master' of https://github.com/php/php-src into typed-properties: Zend/zend_API.c Zend/zend_API.h Z end/zend_ast.c
Zend/zend_compile.c Zend/zend_comp ile.h Zend/zend_execute.c Zend/zend_execute.h Z end/zend_execute_API.c Zend/zend_inheritance.c Ze
nd/zend_language_parser.y Zend/zend_vm_def.h Ze nd/zend_vm_execute.h ext/reflection/php_reflection. c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95581@lists.php.net to get a copy of this message
Commit: a684a3685fea8cbe686d0d794577998c0ee3c6c7 Author: Joe Watkins <krakjoe@php.net> Tue, 5 Apr 2016 06:55:27 +0100 Parents: a99e7d11949c385bc0923ad911421639de354219 b68e89ee7e0f53533e33e13b25c3b57c63486082 Branches: typed_ref_properties Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a684a3685fea8cbe686d0d794577998c0ee3c6c7 Log: Merge branch 'master' of https://github.com/php/php-src into typed-properties Conflicts: Zend/zend_vm_execute.h Changed paths: MM Zend/zend_API.c MM Zend/zend_API.h MM Zend/zend_ast.c MM Zend/zend_compile.c MM Zend/zend_compile.h MM Zend/zend_execute.c MM Zend/zend_execute.h MM Zend/zend_execute_API.c MM Zend/zend_inheritance.c MM Zend/zend_language_parser.y MM Zend/zend_vm_def.h MM Zend/zend_vm_execute.h MM ext/reflection/php_reflection.c Diff: diff --cc Zend/zend_language_parser.y index ffa06b9,0ec991e..b384179 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@@ -701,9 -701,8 +701,9 @@@ class_statement_list class_statement: - variable_modifiers property_list ';' - { $$ = $2; $$->attr = $1; } + variable_modifiers optional_type property_list ';' + { $3->attr = $1; - $$ = zend_ast_create(ZEND_AST_PROP_LIST, $2, $3); } ++ $$ = zend_ast_create(ZEND_AST_PROP_GROUP, $2, $3); } | method_modifiers T_CONST class_const_list ';' { $$ = $3; $$->attr = $1; } | T_USE name_list trait_adaptations diff --cc Zend/zend_vm_execute.h index 346f368,0eb5dc7..195679e --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@@ -32405,194 -31567,7 +32567,194 @@@ static ZEND_OPCODE_HANDLER_RET ZEND_FAS } property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); - value = _get_zval_ptr_var((opline+1)->op1.var, execute_data, &free_op_data); + value = _get_zval_ptr_tmp((opline+1)->op1.var, execute_data, &free_op_data); + + if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { + do { + if (IS_UNUSED == IS_VAR && UNEXPECTED(Z_ISERROR_P(object))) { + if (UNEXPECTED(RETURN_VALUE_USED(opline))) { + ZVAL_NULL(EX_VAR(opline->result.var)); + } + zval_ptr_dtor_nogc(free_op_data); + goto exit_assign_obj; + } + if (Z_ISREF_P(object)) { + object = Z_REFVAL_P(object); + if (EXPECTED(Z_TYPE_P(object) == IS_OBJECT)) { + break; + } + } + if (EXPECTED(Z_TYPE_P(object) <= IS_FALSE || + (Z_TYPE_P(object) == IS_STRING && Z_STRLEN_P(object) == 0))) { + zend_object *obj; + + zval_ptr_dtor(object); + object_init(object); + Z_ADDREF_P(object); + obj = Z_OBJ_P(object); + zend_error(E_WARNING, "Creating default object from empty value"); + if (GC_REFCOUNT(obj) == 1) { + /* the enclosing container was deleted, obj is unreferenced */ + if (UNEXPECTED(RETURN_VALUE_USED(opline))) { + ZVAL_NULL(EX_VAR(opline->result.var)); + } + zval_ptr_dtor_nogc(free_op_data); + OBJ_RELEASE(obj); + goto exit_assign_obj; + } + Z_DELREF_P(object); + } else { + zend_error(E_WARNING, "Attempt to assign property of non-object"); + if (UNEXPECTED(RETURN_VALUE_USED(opline))) { + ZVAL_NULL(EX_VAR(opline->result.var)); + } + zval_ptr_dtor_nogc(free_op_data); + goto exit_assign_obj; + } + } while (0); + } + + if (IS_CV == IS_CONST && + EXPECTED(Z_OBJCE_P(object) == CACHED_PTR(Z_CACHE_SLOT_P(property_name)))) { + uint32_t prop_offset = (uint32_t)(intptr_t)CACHED_PTR(Z_CACHE_SLOT_P(property_name) + sizeof(void*)); + zend_object *zobj = Z_OBJ_P(object); + zval *property; + + if (EXPECTED(prop_offset != (uint32_t)ZEND_DYNAMIC_PROPERTY_OFFSET)) { + property = OBJ_PROP(zobj, prop_offset); + if (Z_TYPE_P(property) != IS_UNDEF) { +fast_assign_obj: + value = zend_assign_to_variable(property, value, IS_TMP_VAR); + if (UNEXPECTED(RETURN_VALUE_USED(opline))) { + ZVAL_COPY(EX_VAR(opline->result.var), value); + } + goto exit_assign_obj; + } + } else { + if (EXPECTED(zobj->properties != NULL)) { + if (UNEXPECTED(GC_REFCOUNT(zobj->properties) > 1)) { + if (EXPECTED(!(GC_FLAGS(zobj->properties) & IS_ARRAY_IMMUTABLE))) { + GC_REFCOUNT(zobj->properties)--; + } + zobj->properties = zend_array_dup(zobj->properties); + } + property = zend_hash_find(zobj->properties, Z_STR_P(property_name)); + if (property) { + goto fast_assign_obj; + } + } + + if (!zobj->ce->__set) { + + if (EXPECTED(zobj->properties == NULL)) { + rebuild_object_properties(zobj); + } + /* separate our value if necessary */ + if (IS_TMP_VAR == IS_CONST) { + if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) { + ZVAL_COPY_VALUE(&tmp, value); + zval_copy_ctor_func(&tmp); + value = &tmp; + } + } else if (IS_TMP_VAR != IS_TMP_VAR) { + if (Z_ISREF_P(value)) { + if (IS_TMP_VAR == IS_VAR) { + zend_reference *ref = Z_REF_P(value); + if (--GC_REFCOUNT(ref) == 0) { + ZVAL_COPY_VALUE(&tmp, Z_REFVAL_P(value)); + efree_size(ref, sizeof(zend_reference)); + value = &tmp; + } else { + value = Z_REFVAL_P(value); + if (Z_REFCOUNTED_P(value)) { + Z_ADDREF_P(value); + } + } + } else { + value = Z_REFVAL_P(value); + if (Z_REFCOUNTED_P(value)) { + Z_ADDREF_P(value); + } + } + } else if (IS_TMP_VAR == IS_CV && Z_REFCOUNTED_P(value)) { + Z_ADDREF_P(value); + } + } + zend_hash_add_new(zobj->properties, Z_STR_P(property_name), value); + if (UNEXPECTED(RETURN_VALUE_USED(opline))) { + ZVAL_COPY(EX_VAR(opline->result.var), value); + } + goto exit_assign_obj; + } + } + } + + if (!Z_OBJ_HT_P(object)->write_property) { + zend_error(E_WARNING, "Attempt to assign property of non-object"); + if (UNEXPECTED(RETURN_VALUE_USED(opline))) { + ZVAL_NULL(EX_VAR(opline->result.var)); + } + zval_ptr_dtor_nogc(free_op_data); + goto exit_assign_obj; + } + + /* separate our value if necessary */ + if (IS_TMP_VAR == IS_CONST) { + if (UNEXPECTED(Z_OPT_COPYABLE_P(value))) { + ZVAL_COPY_VALUE(&tmp, value); + zval_copy_ctor_func(&tmp); + value = &tmp; + } + } else if (IS_TMP_VAR != IS_TMP_VAR) { + ZVAL_DEREF(value); + } + + Z_OBJ_HT_P(object)->write_property(object, property_name, value, (IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL); + + if (UNEXPECTED(RETURN_VALUE_USED(opline)) && EXPECTED(!EG(exception))) { + ZVAL_COPY(EX_VAR(opline->result.var), value); + } + + if (UNEXPECTED(ZEND_OBJECT_HAS_TYPE_HINTS(object))) { + zend_property_info *prop_info = zend_object_fetch_property_type_info(object, property_name, ((IS_CV == IS_CONST) ? CACHE_ADDR(Z_CACHE_SLOT_P(property_name)) : NULL)); + + if (prop_info) { + if (!zend_verify_property_type(prop_info, value, EX_USES_STRICT_TYPES())) { + zend_verify_property_type_error(prop_info, Z_STR_P(property_name), value); + HANDLE_EXCEPTION(); + } + } + } + + if (IS_TMP_VAR == IS_CONST) { + zval_ptr_dtor_nogc(value); + } else { + zval_ptr_dtor_nogc(free_op_data); + } +exit_assign_obj: + + + /* assign_obj has two opcodes! */ + ZEND_VM_NEXT_OPCODE_EX(1, 2); +} + +static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_DATA_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + zend_free_op free_op_data; + zval *object, *property_name, *value, tmp; + + SAVE_OPLINE(); + object = _get_obj_zval_ptr_unused(execute_data); + - if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_OBJ_P(object) == NULL)) { ++ if (IS_UNUSED == IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) { + zend_throw_error(NULL, "Using $this when not in object context"); + + HANDLE_EXCEPTION(); + } + + property_name = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op2.var); + value = _get_zval_ptr_var((opline+1)->op1.var, execute_data, &free_op_data); if (IS_UNUSED != IS_UNUSED && UNEXPECTED(Z_TYPE_P(object) != IS_OBJECT)) { do {

« previous php.cvs (#95581) next »