diff options
Diffstat (limited to 'Zend')
| -rw-r--r-- | Zend/tests/traits/bug65576a.phpt | 31 | ||||
| -rw-r--r-- | Zend/tests/traits/bug65576b.phpt | 33 | ||||
| -rw-r--r-- | Zend/zend_API.c | 36 | ||||
| -rw-r--r-- | Zend/zend_API.h | 29 | ||||
| -rw-r--r-- | Zend/zend_closures.c | 4 | ||||
| -rw-r--r-- | Zend/zend_compile.c | 8 | ||||
| -rw-r--r-- | Zend/zend_compile.h | 1 | ||||
| -rw-r--r-- | Zend/zend_exceptions.c | 6 | ||||
| -rw-r--r-- | Zend/zend_execute.c | 18 | ||||
| -rw-r--r-- | Zend/zend_execute_API.c | 4 | ||||
| -rw-r--r-- | Zend/zend_generators.c | 2 | ||||
| -rw-r--r-- | Zend/zend_indent.c | 2 | ||||
| -rw-r--r-- | Zend/zend_inheritance.c | 10 | ||||
| -rw-r--r-- | Zend/zend_interfaces.c | 8 | ||||
| -rw-r--r-- | Zend/zend_iterators.c | 7 | ||||
| -rw-r--r-- | Zend/zend_language_parser.y | 2 | ||||
| -rw-r--r-- | Zend/zend_operators.h | 12 | ||||
| -rw-r--r-- | Zend/zend_virtual_cwd.c | 2 | ||||
| -rw-r--r-- | Zend/zend_vm_def.h | 4 | ||||
| -rw-r--r-- | Zend/zend_vm_execute.h | 4 |
20 files changed, 156 insertions, 67 deletions
diff --git a/Zend/tests/traits/bug65576a.phpt b/Zend/tests/traits/bug65576a.phpt new file mode 100644 index 0000000000..49b2ba0c96 --- /dev/null +++ b/Zend/tests/traits/bug65576a.phpt @@ -0,0 +1,31 @@ +--TEST-- +Bug #65576 (Constructor from trait conflicts with inherited constructor) +--FILE-- +<?php + +trait T +{ + public function __construct() + { + echo "Trait contructor\n"; + } +} + +class A +{ + public function __construct() + { + echo "Parent constructor\n"; + } +} + +class B extends A +{ + use T; +} + +new B(); + +--EXPECT-- +Trait contructor + diff --git a/Zend/tests/traits/bug65576b.phpt b/Zend/tests/traits/bug65576b.phpt new file mode 100644 index 0000000000..3be52ba7c9 --- /dev/null +++ b/Zend/tests/traits/bug65576b.phpt @@ -0,0 +1,33 @@ +--TEST-- +Bug #65576 (Constructor from trait conflicts with inherited constructor) +--FILE-- +<?php + +trait T +{ + public function __construct() + { + parent::__construct(); + echo "Trait contructor\n"; + } +} + +class A +{ + public function __construct() + { + echo "Parent constructor\n"; + } +} + +class B extends A +{ + use T; +} + +new B(); + +--EXPECT-- +Parent constructor +Trait contructor + diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 369852ffbe..788da61474 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -404,14 +404,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons if ((type = is_numeric_string(Z_STRVAL_P(arg), Z_STRLEN_P(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { - if (c == 'L') { - if (d > ZEND_LONG_MAX) { - *p = ZEND_LONG_MAX; - break; - } else if (d < ZEND_LONG_MIN) { - *p = ZEND_LONG_MIN; - break; + if (zend_isnan(d)) { + return "long"; + } + if (!ZEND_DOUBLE_FITS_LONG(d)) { + if (c == 'L') { + *p = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return "long"; } + break; } *p = zend_dval_to_lval(d); @@ -420,14 +422,16 @@ static const char *zend_parse_arg_impl(int arg_num, zval *arg, va_list *va, cons break; case IS_DOUBLE: - if (c == 'L') { - if (Z_DVAL_P(arg) > ZEND_LONG_MAX) { - *p = ZEND_LONG_MAX; - break; - } else if (Z_DVAL_P(arg) < ZEND_LONG_MIN) { - *p = ZEND_LONG_MIN; - break; + if (zend_isnan(Z_DVAL_P(arg))) { + return "long"; + } + if (!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg))) { + if (c == 'L') { + *p = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return "long"; } + break; } case IS_NULL: case IS_FALSE: @@ -1127,7 +1131,7 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties TSRMLS_DC) } /* }}} */ -static int zval_update_class_constant(zval *pp, int is_static, int offset TSRMLS_DC) /* {{{ */ +static int zval_update_class_constant(zval *pp, int is_static, uint32_t offset TSRMLS_DC) /* {{{ */ { ZVAL_DEREF(pp); if (Z_CONSTANT_P(pp)) { @@ -2195,7 +2199,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio internal_function->arg_info = (zend_internal_arg_info*)ptr->arg_info+1; internal_function->num_args = ptr->num_args; /* Currently you cannot denote that the function can accept less arguments than num_args */ - if (info->required_num_args == -1) { + if (info->required_num_args == (zend_uintptr_t)-1) { internal_function->required_num_args = ptr->num_args; } else { internal_function->required_num_args = info->required_num_args; diff --git a/Zend/zend_API.h b/Zend/zend_API.h index bee797b7da..1e031ca844 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -525,7 +525,7 @@ ZEND_API zend_array *zend_rebuild_symbol_table(TSRMLS_D); ZEND_API void zend_attach_symbol_table(zend_execute_data *execute_data); ZEND_API void zend_detach_symbol_table(zend_execute_data *execute_data); ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS_DC); -ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC); +ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force TSRMLS_DC); ZEND_API zend_string *zend_find_alias_name(zend_class_entry *ce, zend_string *name); ZEND_API zend_string *zend_resolve_method_name(zend_class_entry *ce, zend_function *f); @@ -1064,10 +1064,16 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (EXPECTED(Z_TYPE_P(arg) == IS_LONG)) { *dest = Z_LVAL_P(arg); } else if (EXPECTED(Z_TYPE_P(arg) == IS_DOUBLE)) { - if (strict && UNEXPECTED(Z_DVAL_P(arg) > ZEND_LONG_MAX)) { - *dest = ZEND_LONG_MAX; - } else if (strict && UNEXPECTED(Z_DVAL_P(arg) < ZEND_LONG_MIN)) { - *dest = ZEND_LONG_MIN; + if (UNEXPECTED(zend_isnan(Z_DVAL_P(arg)))) { + return 0; + } + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(Z_DVAL_P(arg)))) { + /* Ironically, the strict parameter makes zpp *non*-strict here */ + if (strict) { + *dest = (Z_DVAL_P(arg) > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return 0; + } } else { *dest = zend_dval_to_lval(Z_DVAL_P(arg)); } @@ -1077,10 +1083,15 @@ static zend_always_inline int _z_param_long(zval *arg, zend_long *dest, zend_boo if (UNEXPECTED((type = is_numeric_str_function(Z_STR_P(arg), dest, &d)) != IS_LONG)) { if (EXPECTED(type != 0)) { - if (strict && UNEXPECTED(d > ZEND_LONG_MAX)) { - *dest = ZEND_LONG_MAX; - } else if (strict && UNEXPECTED(d < ZEND_LONG_MIN)) { - *dest = ZEND_LONG_MIN; + if (UNEXPECTED(zend_isnan(d))) { + return 0; + } + if (UNEXPECTED(!ZEND_DOUBLE_FITS_LONG(d))) { + if (strict) { + *dest = (d > 0) ? ZEND_LONG_MAX : ZEND_LONG_MIN; + } else { + return 0; + } } else { *dest = zend_dval_to_lval(d); } diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index bf0ba0ace4..94ee585ddc 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -436,7 +436,7 @@ static const zend_function_entry closure_functions[] = { ZEND_ME(Closure, bind, arginfo_closure_bind, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) ZEND_MALIAS(Closure, bindTo, bind, arginfo_closure_bindto, ZEND_ACC_PUBLIC) ZEND_ME(Closure, call, arginfo_closure_call, ZEND_ACC_PUBLIC) - {NULL, NULL, NULL} + ZEND_FE_END }; void zend_register_closure_ce(TSRMLS_D) /* {{{ */ @@ -445,7 +445,7 @@ void zend_register_closure_ce(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "Closure", closure_functions); zend_ce_closure = zend_register_internal_class(&ce TSRMLS_CC); - zend_ce_closure->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_closure->ce_flags |= ZEND_ACC_FINAL; zend_ce_closure->create_object = zend_closure_new; zend_ce_closure->serialize = zend_class_serialize_deny; zend_ce_closure->unserialize = zend_class_unserialize_deny; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 97c10f4ca8..9c5ca95b8d 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1033,7 +1033,7 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ if (CG(compiler_options) & ZEND_COMPILE_DELAYED_BINDING) { uint32_t *opline_num = &CG(active_op_array)->early_binding; - while (*opline_num != -1) { + while (*opline_num != (uint32_t)-1) { opline_num = &CG(active_op_array)->opcodes[*opline_num].result.opline_num; } *opline_num = opline - CG(active_op_array)->opcodes; @@ -1074,13 +1074,13 @@ void zend_do_early_binding(TSRMLS_D) /* {{{ */ ZEND_API void zend_do_delayed_early_binding(const zend_op_array *op_array TSRMLS_DC) /* {{{ */ { - if (op_array->early_binding != -1) { + if (op_array->early_binding != (uint32_t)-1) { zend_bool orig_in_compilation = CG(in_compilation); uint32_t opline_num = op_array->early_binding; zend_class_entry *ce; CG(in_compilation) = 1; - while (opline_num != -1) { + while (opline_num != (uint32_t)-1) { if ((ce = zend_lookup_class(Z_STR_P(RT_CONSTANT(op_array, op_array->opcodes[opline_num-1].op2)) TSRMLS_CC)) != NULL) { do_bind_inherited_class(op_array, &op_array->opcodes[opline_num], EG(class_table), ce, 0 TSRMLS_CC); } @@ -1973,7 +1973,7 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, zend_ast *ast, uint /* there is a chance someone is accessing $this */ if (ast->kind != ZEND_AST_ZVAL - && CG(active_op_array)->scope && CG(active_op_array)->this_var == -1 + && CG(active_op_array)->scope && CG(active_op_array)->this_var == (uint32_t)-1 ) { zend_string *key = zend_string_init("this", sizeof("this") - 1, 0); CG(active_op_array)->this_var = lookup_cv(CG(active_op_array), key TSRMLS_CC); diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index c44b37b995..3b1e046cc0 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -182,7 +182,6 @@ typedef struct _zend_try_catch_element { /* ZEND_ACC_EXPLICIT_ABSTRACT_CLASS denotes that a class was explicitly defined as abstract by using the keyword. */ #define ZEND_ACC_IMPLICIT_ABSTRACT_CLASS 0x10 #define ZEND_ACC_EXPLICIT_ABSTRACT_CLASS 0x20 -#define ZEND_ACC_FINAL_CLASS 0x40 #define ZEND_ACC_INTERFACE 0x80 #define ZEND_ACC_TRAIT 0x120 diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c index 4159a46d3c..0d5fc53da8 100644 --- a/Zend/zend_exceptions.c +++ b/Zend/zend_exceptions.c @@ -664,7 +664,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_exception___construct, 0, 0, 0) ZEND_ARG_INFO(0, previous) ZEND_END_ARG_INFO() -const static zend_function_entry default_exception_functions[] = { +static const zend_function_entry default_exception_functions[] = { ZEND_ME(exception, __clone, NULL, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) ZEND_ME(exception, __construct, arginfo_exception___construct, ZEND_ACC_PUBLIC) ZEND_ME(exception, getMessage, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) @@ -675,7 +675,7 @@ const static zend_function_entry default_exception_functions[] = { ZEND_ME(exception, getPrevious, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(exception, getTraceAsString, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) ZEND_ME(exception, __toString, NULL, 0) - {NULL, NULL, NULL} + ZEND_FE_END }; ZEND_BEGIN_ARG_INFO_EX(arginfo_error_exception___construct, 0, 0, 0) @@ -690,7 +690,7 @@ ZEND_END_ARG_INFO() static const zend_function_entry error_exception_functions[] = { ZEND_ME(error_exception, __construct, arginfo_error_exception___construct, ZEND_ACC_PUBLIC) ZEND_ME(error_exception, getSeverity, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) - {NULL, NULL, NULL} + ZEND_FE_END }; /* }}} */ diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index aff92a3952..0a156f84a4 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1168,7 +1168,7 @@ str_index: return retval; } -static zend_never_inline zend_long zend_check_string_offset(zval *container, zval *dim, int type TSRMLS_DC) +static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type TSRMLS_DC) { zend_long offset; @@ -1211,7 +1211,7 @@ try_again: static zend_always_inline zend_long zend_fetch_string_offset(zval *container, zval *dim, int type TSRMLS_DC) { - zend_long offset = zend_check_string_offset(container, dim, type TSRMLS_CC); + zend_long offset = zend_check_string_offset(dim, type TSRMLS_CC); if (Z_REFCOUNTED_P(container)) { if (Z_REFCOUNT_P(container) > 1) { @@ -1250,7 +1250,7 @@ convert_to_array: goto fetch_from_array; } - zend_check_string_offset(container, dim, type TSRMLS_CC); + zend_check_string_offset(dim, type TSRMLS_CC); ZVAL_INDIRECT(result, NULL); /* wrong string offset */ } else if (EXPECTED(Z_TYPE_P(container) == IS_OBJECT)) { @@ -1666,12 +1666,12 @@ static zend_always_inline void i_init_func_execute_data(zend_execute_data *execu } while (var != end); } - if (op_array->this_var != -1 && Z_OBJ(EX(This))) { + if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } - if (!op_array->run_time_cache && op_array->last_cache_slot) { + if (UNEXPECTED(!op_array->run_time_cache)) { op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*)); } EX_LOAD_RUN_TIME_CACHE(op_array); @@ -1691,12 +1691,12 @@ static zend_always_inline void i_init_code_execute_data(zend_execute_data *execu zend_attach_symbol_table(execute_data); - if (op_array->this_var != -1 && Z_OBJ(EX(This))) { + if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } - if (!op_array->run_time_cache && op_array->last_cache_slot) { + if (!op_array->run_time_cache) { op_array->run_time_cache = ecalloc(op_array->last_cache_slot, sizeof(void*)); } EX_LOAD_RUN_TIME_CACHE(op_array); @@ -1762,12 +1762,12 @@ static zend_always_inline void i_init_execute_data(zend_execute_data *execute_da } } - if (op_array->this_var != -1 && Z_OBJ(EX(This))) { + if (op_array->this_var != (uint32_t)-1 && EXPECTED(Z_OBJ(EX(This)))) { ZVAL_OBJ(EX_VAR(op_array->this_var), Z_OBJ(EX(This))); GC_REFCOUNT(Z_OBJ(EX(This)))++; } - if (!op_array->run_time_cache && op_array->last_cache_slot) { + if (!op_array->run_time_cache) { if (op_array->function_name) { op_array->run_time_cache = zend_arena_calloc(&CG(arena), op_array->last_cache_slot, sizeof(void*)); } else { diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 760747affa..480206bfb5 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -218,7 +218,7 @@ void shutdown_destructors(TSRMLS_D) /* {{{ */ EG(symbol_table).ht.pDestructor = zend_unclean_zval_ptr_dtor; } zend_try { - int symbols; + uint32_t symbols; do { symbols = zend_hash_num_elements(&EG(symbol_table).ht); zend_hash_reverse_apply(&EG(symbol_table).ht, (apply_func_t) zval_call_destructor TSRMLS_CC); @@ -1542,7 +1542,7 @@ ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force TSRMLS } /* }}} */ -ZEND_API int zend_set_local_var_str(const char *name, int len, zval *value, int force TSRMLS_DC) /* {{{ */ +ZEND_API int zend_set_local_var_str(const char *name, size_t len, zval *value, int force TSRMLS_DC) /* {{{ */ { zend_execute_data *execute_data = EG(current_execute_data); diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 2d1810ef78..c3827c5c51 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -671,7 +671,7 @@ void zend_register_generator_ce(TSRMLS_D) /* {{{ */ INIT_CLASS_ENTRY(ce, "Generator", generator_functions); zend_ce_generator = zend_register_internal_class(&ce TSRMLS_CC); - zend_ce_generator->ce_flags |= ZEND_ACC_FINAL_CLASS; + zend_ce_generator->ce_flags |= ZEND_ACC_FINAL; zend_ce_generator->create_object = zend_generator_create; zend_ce_generator->serialize = zend_class_serialize_deny; zend_ce_generator->unserialize = zend_class_unserialize_deny; diff --git a/Zend/zend_indent.c b/Zend/zend_indent.c index b5884c72c0..22cc4d2b9e 100644 --- a/Zend/zend_indent.c +++ b/Zend/zend_indent.c @@ -34,7 +34,7 @@ static void handle_whitespace(unsigned int *emit_whitespace) { unsigned char c; - int i; + unsigned int i; for (c=0; c<128; c++) { if (emit_whitespace[c]>0) { diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 8f0d9fecb7..8963d2b93b 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -591,7 +591,7 @@ static zend_bool do_inherit_method_check(HashTable *child_function_table, zend_f } /* }}} */ -static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_property_info *parent_info, zend_string *key, zend_class_entry *ce TSRMLS_DC) /* {{{ */ +static zend_bool do_inherit_property_access_check(zend_property_info *parent_info, zend_string *key, zend_class_entry *ce TSRMLS_DC) /* {{{ */ { zend_property_info *child_info; zend_class_entry *parent_ce = ce->parent; @@ -727,7 +727,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent && !(parent_ce->ce_flags & ZEND_ACC_INTERFACE)) { zend_error_noreturn(E_COMPILE_ERROR, "Interface %s may not inherit from class (%s)", ce->name->val, parent_ce->name->val); } - if (parent_ce->ce_flags & ZEND_ACC_FINAL_CLASS) { + if (parent_ce->ce_flags & ZEND_ACC_FINAL) { zend_error_noreturn(E_COMPILE_ERROR, "Class %s may not inherit from final class (%s)", ce->name->val, parent_ce->name->val); } @@ -831,7 +831,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent } ZEND_HASH_FOREACH_END(); ZEND_HASH_FOREACH_STR_KEY_PTR(&parent_ce->properties_info, key, property_info) { - if (do_inherit_property_access_check(&ce->properties_info, property_info, key, ce TSRMLS_CC)) { + if (do_inherit_property_access_check(property_info, key, ce TSRMLS_CC)) { if (ce->type & ZEND_INTERNAL_CLASS) { property_info = zend_duplicate_property_info_internal(property_info); } else { @@ -992,7 +992,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen if (!strncmp(mname->val, ZEND_CLONE_FUNC_NAME, mname->len)) { ce->clone = fe; fe->common.fn_flags |= ZEND_ACC_CLONE; } else if (!strncmp(mname->val, ZEND_CONSTRUCTOR_FUNC_NAME, mname->len)) { - if (ce->constructor) { + if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val); } ce->constructor = fe; fe->common.fn_flags |= ZEND_ACC_CTOR; @@ -1019,7 +1019,7 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen zend_str_tolower_copy(lowercase_name->val, ce->name->val, ce->name->len); lowercase_name = zend_new_interned_string(lowercase_name TSRMLS_CC); if (!memcmp(mname->val, lowercase_name->val, mname->len)) { - if (ce->constructor) { + if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ce->name->val); } ce->constructor = fe; diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index f076289201..16ae8ea3c5 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -499,7 +499,7 @@ static int zend_implement_serializable(zend_class_entry *interface, zend_class_e /* {{{ function tables */ const zend_function_entry zend_funcs_aggregate[] = { ZEND_ABSTRACT_ME(iterator, getIterator, NULL) - {NULL, NULL, NULL} + ZEND_FE_END }; const zend_function_entry zend_funcs_iterator[] = { @@ -508,7 +508,7 @@ const zend_function_entry zend_funcs_iterator[] = { ZEND_ABSTRACT_ME(iterator, key, NULL) ZEND_ABSTRACT_ME(iterator, valid, NULL) ZEND_ABSTRACT_ME(iterator, rewind, NULL) - {NULL, NULL, NULL} + ZEND_FE_END }; const zend_function_entry *zend_funcs_traversable = NULL; @@ -531,7 +531,7 @@ const zend_function_entry zend_funcs_arrayaccess[] = { ZEND_ABSTRACT_ME(arrayaccess, offsetGet, arginfo_arrayaccess_offset_get) ZEND_ABSTRACT_ME(arrayaccess, offsetSet, arginfo_arrayaccess_offset_value) ZEND_ABSTRACT_ME(arrayaccess, offsetUnset, arginfo_arrayaccess_offset) - {NULL, NULL, NULL} + ZEND_FE_END }; ZEND_BEGIN_ARG_INFO(arginfo_serializable_serialize, 0) @@ -541,7 +541,7 @@ ZEND_END_ARG_INFO() const zend_function_entry zend_funcs_serializable[] = { ZEND_ABSTRACT_ME(serializable, serialize, NULL) ZEND_FENTRY(unserialize, NULL, arginfo_serializable_serialize, ZEND_ACC_PUBLIC|ZEND_ACC_ABSTRACT|ZEND_ACC_CTOR) - {NULL, NULL, NULL} + ZEND_FE_END }; /* }}} */ diff --git a/Zend/zend_iterators.c b/Zend/zend_iterators.c index 8edd5dbdc4..8d81eae3b0 100644 --- a/Zend/zend_iterators.c +++ b/Zend/zend_iterators.c @@ -50,7 +50,12 @@ static zend_object_handlers iterator_object_handlers = { NULL, /* get class name */ NULL, /* compare */ NULL, /* cast */ - NULL /* count */ + NULL, /* count */ + NULL, /* get_debug_info */ + NULL, /* get_closure */ + NULL, /* get_gc */ + NULL, /* do_operation */ + NULL /* compare */ }; ZEND_API void zend_register_iterator_wrapper(TSRMLS_D) diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y index 11c9827d5b..caa611460d 100644 --- a/Zend/zend_language_parser.y +++ b/Zend/zend_language_parser.y @@ -431,7 +431,7 @@ class_declaration_statement: class_type: T_CLASS { $$ = 0; } | T_ABSTRACT T_CLASS { $$ = ZEND_ACC_EXPLICIT_ABSTRACT_CLASS; } - | T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL_CLASS; } + | T_FINAL T_CLASS { $$ = ZEND_ACC_FINAL; } | T_TRAIT { $$ = ZEND_ACC_TRAIT; } ; diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index ccd00b4e52..d27f5bf6f6 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -89,6 +89,13 @@ ZEND_API zend_uchar _is_numeric_string_ex(const char *str, size_t length, zend_l END_EXTERN_C() +#if SIZEOF_ZEND_LONG == 4 +# define ZEND_DOUBLE_FITS_LONG(d) (!((d) > ZEND_LONG_MAX || (d) < ZEND_LONG_MIN)) +#else + /* >= as (double)ZEND_LONG_MAX is outside signed range */ +# define ZEND_DOUBLE_FITS_LONG(d) (!((d) >= ZEND_LONG_MAX || (d) < ZEND_LONG_MIN)) +#endif + #if ZEND_DVAL_TO_LVAL_CAST_OK static zend_always_inline zend_long zend_dval_to_lval(double d) { @@ -103,7 +110,7 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) { if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) { return 0; - } else if (d > ZEND_LONG_MAX || d < ZEND_LONG_MIN) { + } else if (!ZEND_DOUBLE_FITS_LONG(d)) { double two_pow_32 = pow(2., 32.), dmod; @@ -122,8 +129,7 @@ static zend_always_inline zend_long zend_dval_to_lval(double d) { if (UNEXPECTED(!zend_finite(d)) || UNEXPECTED(zend_isnan(d))) { return 0; - /* >= as (double)ZEND_LONG_MAX is outside signed range */ - } else if (d >= ZEND_LONG_MAX || d < ZEND_LONG_MIN) { + } else if (!ZEND_DOUBLE_FITS_LONG(d)) { double two_pow_64 = pow(2., 64.), dmod; diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 509b33e369..33bfddc3f9 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -620,7 +620,7 @@ static inline zend_ulong realpath_cache_key(const char *path, int path_len) /* { CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */ { - int i; + uint32_t i; for (i = 0; i < sizeof(CWDG(realpath_cache))/sizeof(CWDG(realpath_cache)[0]); i++) { realpath_cache_bucket *p = CWDG(realpath_cache)[i]; diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 223ecf9a0d..0bf218d581 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -5513,8 +5513,8 @@ ZEND_VM_HANDLER(105, ZEND_TICKS, ANY, ANY) USE_OPLINE SAVE_OPLINE(); - if (++EG(ticks_count)>=opline->extended_value) { - EG(ticks_count)=0; + if ((uint32_t)++EG(ticks_count) >= opline->extended_value) { + EG(ticks_count) = 0; if (zend_ticks_function) { zend_ticks_function(opline->extended_value TSRMLS_CC); } diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 408b59d692..038953ccd4 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -1144,8 +1144,8 @@ static int ZEND_FASTCALL ZEND_TICKS_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) USE_OPLINE SAVE_OPLINE(); - if (++EG(ticks_count)>=opline->extended_value) { - EG(ticks_count)=0; + if ((uint32_t)++EG(ticks_count) >= opline->extended_value) { + EG(ticks_count) = 0; if (zend_ticks_function) { zend_ticks_function(opline->extended_value TSRMLS_CC); } |
