diff options
author | Anatol Belski <ab@php.net> | 2014-10-05 19:26:17 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-10-05 19:26:17 +0200 |
commit | a91d3580a7c9461729608c4b7e2c193cdf4206ce (patch) | |
tree | 3a1b3b4dc105b1d46a9609a8b485c041304bd50c | |
parent | 11cf279196a7edba43080b3497fa04abe5a0e5f5 (diff) | |
parent | d58b70622a7e99ceee074e420d9271c2d8de116c (diff) | |
download | php-git-a91d3580a7c9461729608c4b7e2c193cdf4206ce.tar.gz |
Merge remote-tracking branch 'origin/master' into native-tls
* origin/master:
properly export tsrm_strtok_r()
Fixed list() behavior inconsistency (string handling is disabled for all cases, ArrayAccess objects handling is enabled for all cases, ZEND_FETCH_DIM_TMP_VAR opcode is renamed into ZEND_FETCH_LIST, ZEND_FETCH_ADD_LOCK flag is removed).
Fix accidental edit in previous commit
Fix arginfo
DateTimeZone::getOffset() now accepts a DateTimeInterface
DateTimeZone::getOffset() now accepts a DateTimeInterface
Moved checks and error reporting related to static methods from DO_FCALL inti INTI_FCALL* opcodes that may really deal with static methods. (In some rare cases it may lead to different order of warning messages).
Fixed a bug that causes crash when environment variable is access while parsing php.ini
Fixed a bug that causes crash when environment variable is access while parsing php.ini
27 files changed, 638 insertions, 491 deletions
diff --git a/TSRM/tsrm_strtok_r.c b/TSRM/tsrm_strtok_r.c index e9ad26a7ac..2522cf1d48 100644 --- a/TSRM/tsrm_strtok_r.c +++ b/TSRM/tsrm_strtok_r.c @@ -14,7 +14,7 @@ static inline int in_character_class(char ch, const char *delim) return 0; } -char *tsrm_strtok_r(char *s, const char *delim, char **last) +TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last) { char *token; diff --git a/TSRM/tsrm_strtok_r.h b/TSRM/tsrm_strtok_r.h index 8c9e8198e7..323b401d99 100644 --- a/TSRM/tsrm_strtok_r.h +++ b/TSRM/tsrm_strtok_r.h @@ -1,6 +1,8 @@ #ifndef TSRM_STRTOK_R #define TSRM_STRTOK_R -char *tsrm_strtok_r(char *s, const char *delim, char **last); +#include "TSRM.h" + +TSRM_API char *tsrm_strtok_r(char *s, const char *delim, char **last); #endif diff --git a/Zend/tests/bug39304.phpt b/Zend/tests/bug39304.phpt index 5540135fa4..2e9ebcdee4 100644 --- a/Zend/tests/bug39304.phpt +++ b/Zend/tests/bug39304.phpt @@ -8,9 +8,5 @@ echo "I am alive"; ?> --EXPECTF-- Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d - -Notice: Uninitialized string offset: 0 in %sbug39304.php on line %d - -Notice: Uninitialized string offset: 1 in %sbug39304.php on line %d I am alive diff --git a/Zend/tests/bug39304_2_4.phpt b/Zend/tests/bug39304_2_4.phpt index cc0709b424..917c64e2cd 100644 --- a/Zend/tests/bug39304_2_4.phpt +++ b/Zend/tests/bug39304_2_4.phpt @@ -10,9 +10,5 @@ Bug #39304 (Segmentation fault with list unpacking of string offset) ?> --EXPECTF-- Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line %d - -Notice: Uninitialized string offset: 0 in %sbug39304_2_4.php on line %d - -Notice: Uninitialized string offset: 1 in %sbug39304_2_4.php on line %d -string(0) "" -string(0) "" +NULL +NULL diff --git a/Zend/tests/foreach_list_002.phpt b/Zend/tests/foreach_list_002.phpt index bc17d94268..1a7be521b2 100644 --- a/Zend/tests/foreach_list_002.phpt +++ b/Zend/tests/foreach_list_002.phpt @@ -18,9 +18,5 @@ foreach($array as list(, $a)) { int(1) int(3) string(1) "b" - -Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d -string(0) "" - -Notice: Uninitialized string offset: 1 in %sforeach_list_002.php on line %d -string(0) "" +NULL +NULL diff --git a/Zend/tests/list_005.phpt b/Zend/tests/list_005.phpt index ec5640a60a..a3b0d57434 100644 --- a/Zend/tests/list_005.phpt +++ b/Zend/tests/list_005.phpt @@ -35,9 +35,9 @@ var_dump($a, $b, $c); ?> --EXPECTF-- -string(1) "f" -string(1) "o" -string(1) "o" +NULL +NULL +NULL ---- NULL NULL diff --git a/Zend/tests/list_007.phpt b/Zend/tests/list_007.phpt index 35a25bce65..cc712406ec 100644 --- a/Zend/tests/list_007.phpt +++ b/Zend/tests/list_007.phpt @@ -8,6 +8,5 @@ list($x, $y) = function() { }; var_dump($x, $y); ?> ---EXPECT-- -NULL -NULL +--EXPECTF-- +Fatal error: Cannot use object of type Closure as array in %slist_007.php on line 3 diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 293c0eee1d..1c21a20888 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -513,15 +513,17 @@ void zend_do_free(znode *op1 TSRMLS_DC) /* {{{ */ } } else { while (opline>CG(active_op_array)->opcodes) { - if (opline->opcode == ZEND_FETCH_DIM_R - && opline->op1_type == IS_VAR - && opline->op1.var == op1->u.op.var) { - /* This should the end of a list() construct - * Mark its result as unused - */ - opline->extended_value = ZEND_FETCH_STANDARD; - break; - } else if (opline->result_type==IS_VAR + if (opline->opcode == ZEND_FETCH_LIST && + opline->op1_type == IS_VAR && + opline->op1.var == op1->u.op.var) { + opline = get_next_op(CG(active_op_array) TSRMLS_CC); + + opline->opcode = ZEND_FREE; + SET_NODE(opline->op1, op1); + SET_UNUSED(opline->op2); + return; + } + if (opline->result_type==IS_VAR && opline->result.var == op1->u.op.var) { if (opline->opcode == ZEND_NEW) { opline->result_type |= EXT_TYPE_UNUSED; @@ -2172,20 +2174,6 @@ void zend_compile_static_prop(znode *result, zend_ast *ast, uint32_t type TSRMLS } /* }}} */ -static inline zend_uchar get_list_fetch_opcode(zend_uchar op_type) /* {{{ */ -{ - switch (op_type) { - case IS_VAR: - case IS_CV: - return ZEND_FETCH_DIM_R; - case IS_TMP_VAR: - case IS_CONST: - return ZEND_FETCH_DIM_TMP_VAR; - EMPTY_SWITCH_DEFAULT_CASE() - } -} -/* }}} */ - static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_node TSRMLS_DC) /* {{{ */ { zend_ast_list *list = zend_ast_get_list(ast); @@ -2212,8 +2200,7 @@ static void zend_compile_list_assign(znode *result, zend_ast *ast, znode *expr_n } opline = zend_emit_op(&fetch_result, - get_list_fetch_opcode(expr_node->op_type), expr_node, &dim_node TSRMLS_CC); - opline->extended_value |= ZEND_FETCH_ADD_LOCK; + ZEND_FETCH_LIST, expr_node, &dim_node TSRMLS_CC); zend_emit_assign_znode(var_ast, &fetch_result TSRMLS_CC); } diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index 2594495c96..c13184c7d8 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -614,7 +614,6 @@ int zend_add_literal(zend_op_array *op_array, zval *zv TSRMLS_DC); #define ZEND_FETCH_TYPE_MASK 0x70000000 #define ZEND_FETCH_STANDARD 0x00000000 -#define ZEND_FETCH_ADD_LOCK 0x08000000 #define ZEND_FETCH_MAKE_REF 0x04000000 #define ZEND_ISSET 0x02000000 diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7fa544b579..61224297b5 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1209,9 +1209,7 @@ ZEND_VM_HANDLER(81, ZEND_FETCH_DIM_R, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV) container = GET_OP1_ZVAL_PTR(BP_VAR_R); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE TSRMLS_CC); FREE_OP2(); - if (OP1_TYPE != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - FREE_OP1(); - } + FREE_OP1(); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -1506,23 +1504,34 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV) ZEND_VM_NEXT_OPCODE(); } -ZEND_VM_HANDLER(98, ZEND_FETCH_DIM_TMP_VAR, CONST|TMP, CONST) +ZEND_VM_HANDLER(98, ZEND_FETCH_LIST, CONST|TMP|VAR|CV, CONST) { USE_OPLINE zend_free_op free_op1; zval *container; SAVE_OPLINE(); - container = GET_OP1_ZVAL_PTR(BP_VAR_R); + container = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R); - if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) { - ZVAL_NULL(EX_VAR(opline->result.var)); - } else { + if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) { zend_free_op free_op2; zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), OP2_TYPE, BP_VAR_R TSRMLS_CC); ZVAL_COPY(EX_VAR(opline->result.var), value); - FREE_OP2(); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) && + EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) { + zval *result = EX_VAR(opline->result.var); + zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, GET_OP2_ZVAL_PTR_DEREF(BP_VAR_R), BP_VAR_R, result TSRMLS_CC); + + if (retval) { + if (result != retval) { + ZVAL_COPY(result, retval); + } + } else { + ZVAL_NULL(result); + } + } else { + ZVAL_NULL(EX_VAR(opline->result.var)); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -2261,16 +2270,25 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -2396,6 +2414,18 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV) if (UNEXPECTED(fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); } + if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } + } } else { called_scope = Z_OBJCE_P(obj); object = Z_OBJ_P(obj); @@ -2452,6 +2482,18 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMP|VAR|CV) object = fcc.object; if (object) { GC_REFCOUNT(object)++; /* For $this pointer */ + } else if (func->common.scope && + !(func->common.fn_flags & ZEND_ACC_STATIC)) { + if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + func->common.scope->name->val, func->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + func->common.scope->name->val, func->common.function_name->val); + } } } else { zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error); @@ -2548,22 +2590,6 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, ANY, ANY) } } } - if (fbc->common.scope && - !(fbc->common.fn_flags & ZEND_ACC_STATIC) && - !object) { - - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - /* FIXME: output identifiers properly */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name->val, fbc->common.function_name->val); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } - } else { - /* FIXME: output identifiers properly */ - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name->val, fbc->common.function_name->val); - } - } LOAD_OPLINE(); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 9f7d4c3a1a..54d2bb2673 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -509,22 +509,6 @@ static int ZEND_FASTCALL ZEND_DO_FCALL_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS) } } } - if (fbc->common.scope && - !(fbc->common.fn_flags & ZEND_ACC_STATIC) && - !object) { - - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - /* FIXME: output identifiers properly */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", fbc->common.scope->name->val, fbc->common.function_name->val); - if (UNEXPECTED(EG(exception) != NULL)) { - HANDLE_EXCEPTION(); - } - } else { - /* FIXME: output identifiers properly */ - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically", fbc->common.scope->name->val, fbc->common.function_name->val); - } - } LOAD_OPLINE(); @@ -1606,6 +1590,18 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CONST_HANDLER(ZEND_OPCODE if (UNEXPECTED(fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); } + if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } + } } else { called_scope = Z_OBJCE_P(obj); object = Z_OBJ_P(obj); @@ -1931,6 +1927,18 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_TMP_HANDLER(ZEND_OPCODE_H if (UNEXPECTED(fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); } + if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } + } } else { called_scope = Z_OBJCE_P(obj); object = Z_OBJ_P(obj); @@ -2105,6 +2113,18 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_VAR_HANDLER(ZEND_OPCODE_H if (UNEXPECTED(fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); } + if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } + } } else { called_scope = Z_OBJCE_P(obj); object = Z_OBJ_P(obj); @@ -2316,6 +2336,18 @@ static int ZEND_FASTCALL ZEND_INIT_FCALL_BY_NAME_SPEC_CV_HANDLER(ZEND_OPCODE_HA if (UNEXPECTED(fbc == NULL)) { zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", called_scope->name->val, Z_STRVAL_P(method)); } + if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) { + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + fbc->common.scope->name->val, fbc->common.function_name->val); + } + } } else { called_scope = Z_OBJCE_P(obj); object = Z_OBJ_P(obj); @@ -3870,9 +3902,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_ container = opline->op1.zv; zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC); - if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -4023,7 +4053,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_CONST_CONST_HANDLER(ZEND_ } } -static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CONST_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -4032,14 +4062,25 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER(ZEND_O SAVE_OPLINE(); container = opline->op1.zv; - if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) { - ZVAL_NULL(EX_VAR(opline->result.var)); - } else { + if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) { zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); ZVAL_COPY(EX_VAR(opline->result.var), value); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) && + EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) { + zval *result = EX_VAR(opline->result.var); + zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC); + if (retval) { + if (result != retval) { + ZVAL_COPY(result, retval); + } + } else { + ZVAL_NULL(result); + } + } else { + ZVAL_NULL(EX_VAR(opline->result.var)); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -4129,16 +4170,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -4186,6 +4236,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CONST_HANDLER(ZEND_OPCO object = fcc.object; if (object) { GC_REFCOUNT(object)++; /* For $this pointer */ + } else if (func->common.scope && + !(func->common.fn_flags & ZEND_ACC_STATIC)) { + if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + func->common.scope->name->val, func->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + func->common.scope->name->val, func->common.function_name->val); + } } } else { zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error); @@ -5196,9 +5258,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE_HA container = opline->op1.zv; zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -5435,16 +5495,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -5492,6 +5561,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_TMP_HANDLER(ZEND_OPCODE object = fcc.object; if (object) { GC_REFCOUNT(object)++; /* For $this pointer */ + } else if (func->common.scope && + !(func->common.fn_flags & ZEND_ACC_STATIC)) { + if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + func->common.scope->name->val, func->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + func->common.scope->name->val, func->common.function_name->val); + } } } else { zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error); @@ -6372,9 +6453,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE_HA container = opline->op1.zv; zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -6611,16 +6690,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -6668,6 +6756,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_VAR_HANDLER(ZEND_OPCODE object = fcc.object; if (object) { GC_REFCOUNT(object)++; /* For $this pointer */ + } else if (func->common.scope && + !(func->common.fn_flags & ZEND_ACC_STATIC)) { + if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + func->common.scope->name->val, func->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + func->common.scope->name->val, func->common.function_name->val); + } } } else { zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error); @@ -7538,16 +7638,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -8285,9 +8394,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_HAN container = opline->op1.zv; zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC); - if (IS_CONST != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -8522,16 +8629,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -8579,6 +8695,18 @@ static int ZEND_FASTCALL ZEND_INIT_USER_CALL_SPEC_CONST_CV_HANDLER(ZEND_OPCODE_ object = fcc.object; if (object) { GC_REFCOUNT(object)++; /* For $this pointer */ + } else if (func->common.scope && + !(func->common.fn_flags & ZEND_ACC_STATIC)) { + if (func->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error(E_STRICT, + "Non-static method %s::%s() should not be called statically", + func->common.scope->name->val, func->common.function_name->val); + } else { + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically", + func->common.scope->name->val, func->common.function_name->val); + } } } else { zend_error(E_WARNING, "%s() expects parameter 1 to be a valid callback, %s", Z_STRVAL_P(opline->op1.zv), error); @@ -10628,9 +10756,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HA container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC); - if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -10781,7 +10907,7 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_FUNC_ARG_SPEC_TMP_CONST_HANDLER(ZEND_OP } } -static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_TMP_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE zend_free_op free_op1; @@ -10790,14 +10916,25 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER(ZEND_OPC SAVE_OPLINE(); container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); - if (UNEXPECTED(Z_TYPE_P(container) != IS_ARRAY)) { - ZVAL_NULL(EX_VAR(opline->result.var)); - } else { + if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) { zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); ZVAL_COPY(EX_VAR(opline->result.var), value); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) && + EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) { + zval *result = EX_VAR(opline->result.var); + zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC); + if (retval) { + if (result != retval) { + ZVAL_COPY(result, retval); + } + } else { + ZVAL_NULL(result); + } + } else { + ZVAL_NULL(EX_VAR(opline->result.var)); } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); @@ -11776,9 +11913,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_TMP_HANDLER(ZEND_OPCODE_HAND container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -12909,9 +13044,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_VAR_HANDLER(ZEND_OPCODE_HAND container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -14638,9 +14771,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_TMP_CV_HANDLER(ZEND_OPCODE_HANDL container = _get_zval_ptr_tmp(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC); - if (IS_TMP_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -17972,9 +18103,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HA container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC); - if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -18267,6 +18396,39 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_VAR_CONST_HANDLER(ZEND_OPCOD ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + zend_free_op free_op1; + zval *container; + + SAVE_OPLINE(); + container = _get_zval_ptr_var_deref(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); + + if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) { + + zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + + ZVAL_COPY(EX_VAR(opline->result.var), value); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) && + EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) { + zval *result = EX_VAR(opline->result.var); + zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC); + + if (retval) { + if (result != retval) { + ZVAL_COPY(result, retval); + } + } else { + ZVAL_NULL(result); + } + } else { + ZVAL_NULL(EX_VAR(opline->result.var)); + } + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -18536,16 +18698,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -20185,9 +20356,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_TMP_HANDLER(ZEND_OPCODE_HAND container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -20752,16 +20921,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -22303,9 +22481,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_VAR_HANDLER(ZEND_OPCODE_HAND container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -22934,16 +23110,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -24401,16 +24586,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -25676,9 +25870,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_VAR_CV_HANDLER(ZEND_OPCODE_HANDL container = _get_zval_ptr_var(opline->op1.var, execute_data, &free_op1 TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC); - if (IS_VAR != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - zval_ptr_dtor_nogc(free_op1.var); - } + zval_ptr_dtor_nogc(free_op1.var); CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -26302,16 +26494,25 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ if (Z_OBJ(EX(This))) { object = Z_OBJ(EX(This)); GC_REFCOUNT(object)++; - if (object->handlers->get_class_entry && - !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC)) { - /* We are calling method of the other (incompatible) class, - but passing $this. This is done for compatibility with php-4. */ - if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } else { - /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ - zend_error_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", fbc->common.scope->name->val, fbc->common.function_name->val); - } + } + if (!object || + (object->handlers->get_class_entry && + !instanceof_function(zend_get_class_entry(object TSRMLS_CC), ce TSRMLS_CC))) { + /* We are calling method of the other (incompatible) class, + but passing $this. This is done for compatibility with php-4. */ + if (fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + zend_error( + object ? E_DEPRECATED : E_STRICT, + "Non-static method %s::%s() should not be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); + } else { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + zend_error_noreturn( + E_ERROR, + "Non-static method %s::%s() cannot be called statically%s", + fbc->common.scope->name->val, fbc->common.function_name->val, + object ? ", assuming $this from incompatible context" : ""); } } } @@ -35008,9 +35209,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HAN container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, opline->op2.zv, IS_CONST TSRMLS_CC); - if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -35303,6 +35502,39 @@ static int ZEND_FASTCALL ZEND_FETCH_OBJ_UNSET_SPEC_CV_CONST_HANDLER(ZEND_OPCODE ZEND_VM_NEXT_OPCODE(); } +static int ZEND_FASTCALL ZEND_FETCH_LIST_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) +{ + USE_OPLINE + + zval *container; + + SAVE_OPLINE(); + container = _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); + + if (EXPECTED(Z_TYPE_P(container) == IS_ARRAY)) { + + zval *value = zend_fetch_dimension_address_inner(Z_ARRVAL_P(container), opline->op2.zv, IS_CONST, BP_VAR_R TSRMLS_CC); + + ZVAL_COPY(EX_VAR(opline->result.var), value); + } else if (UNEXPECTED(Z_TYPE_P(container) == IS_OBJECT) && + EXPECTED(Z_OBJ_HT_P(container)->read_dimension)) { + zval *result = EX_VAR(opline->result.var); + zval *retval = Z_OBJ_HT_P(container)->read_dimension(container, opline->op2.zv, BP_VAR_R, result TSRMLS_CC); + + if (retval) { + if (result != retval) { + ZVAL_COPY(result, retval); + } + } else { + ZVAL_NULL(result); + } + } else { + ZVAL_NULL(EX_VAR(opline->result.var)); + } + CHECK_EXCEPTION(); + ZEND_VM_NEXT_OPCODE(); +} + static int ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { USE_OPLINE @@ -37063,9 +37295,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_TMP_HANDLER(ZEND_OPCODE_HANDL container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_tmp(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_TMP_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -39062,9 +39292,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_VAR_HANDLER(ZEND_OPCODE_HANDL container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_var_deref(opline->op2.var, execute_data, &free_op2 TSRMLS_CC), IS_VAR TSRMLS_CC); zval_ptr_dtor_nogc(free_op2.var); - if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -42179,9 +42407,7 @@ static int ZEND_FASTCALL ZEND_FETCH_DIM_R_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLE container = _get_zval_ptr_cv_BP_VAR_R(execute_data, opline->op1.var TSRMLS_CC); zend_fetch_dimension_address_read_R(EX_VAR(opline->result.var), container, _get_zval_ptr_cv_deref_BP_VAR_R(execute_data, opline->op2.var TSRMLS_CC), IS_CV TSRMLS_CC); - if (IS_CV != IS_VAR || !(opline->extended_value & ZEND_FETCH_ADD_LOCK)) { - } CHECK_EXCEPTION(); ZEND_VM_NEXT_OPCODE(); } @@ -45726,18 +45952,17 @@ void zend_init_opcodes_handlers(void) ZEND_FETCH_OBJ_UNSET_SPEC_CV_VAR_HANDLER, ZEND_NULL_HANDLER, ZEND_FETCH_OBJ_UNSET_SPEC_CV_CV_HANDLER, - ZEND_FETCH_DIM_TMP_VAR_SPEC_CONST_CONST_HANDLER, - ZEND_NULL_HANDLER, - ZEND_NULL_HANDLER, + ZEND_FETCH_LIST_SPEC_CONST_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, - ZEND_FETCH_DIM_TMP_VAR_SPEC_TMP_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_FETCH_LIST_SPEC_TMP_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_FETCH_LIST_SPEC_VAR_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, @@ -45747,6 +45972,7 @@ void zend_init_opcodes_handlers(void) ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, + ZEND_FETCH_LIST_SPEC_CV_CONST_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, ZEND_NULL_HANDLER, diff --git a/Zend/zend_vm_opcodes.c b/Zend/zend_vm_opcodes.c index d31eb14141..067fd362e6 100644 --- a/Zend/zend_vm_opcodes.c +++ b/Zend/zend_vm_opcodes.c @@ -120,7 +120,7 @@ const char *zend_vm_opcodes_map[170] = { "ZEND_FETCH_UNSET", "ZEND_FETCH_DIM_UNSET", "ZEND_FETCH_OBJ_UNSET", - "ZEND_FETCH_DIM_TMP_VAR", + "ZEND_FETCH_LIST", "ZEND_FETCH_CONSTANT", "ZEND_GOTO", "ZEND_EXT_STMT", diff --git a/Zend/zend_vm_opcodes.h b/Zend/zend_vm_opcodes.h index 43aea9ee95..c06fd84ff4 100644 --- a/Zend/zend_vm_opcodes.h +++ b/Zend/zend_vm_opcodes.h @@ -119,7 +119,7 @@ ZEND_API const char *zend_get_opcode_name(zend_uchar opcode); #define ZEND_FETCH_UNSET 95 #define ZEND_FETCH_DIM_UNSET 96 #define ZEND_FETCH_OBJ_UNSET 97 -#define ZEND_FETCH_DIM_TMP_VAR 98 +#define ZEND_FETCH_LIST 98 #define ZEND_FETCH_CONSTANT 99 #define ZEND_GOTO 100 #define ZEND_EXT_STMT 101 diff --git a/ext/date/php_date.c b/ext/date/php_date.c index dbc72d1428..580684c579 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -325,12 +325,12 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_name_from_abbr, 0, 0, 1) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_offset_get, 0, 0, 2) - ZEND_ARG_INFO(0, object) - ZEND_ARG_INFO(0, datetime) + ZEND_ARG_OBJ_INFO(0, object, DateTimeZone, 0) + ZEND_ARG_OBJ_INFO(0, datetime, DateTimeInterface, 0) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_method_offset_get, 0, 0, 1) - ZEND_ARG_INFO(0, datetime) + ZEND_ARG_INFO(0, object) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_timezone_transitions_get, 0, 0, 1) @@ -3798,7 +3798,7 @@ PHP_FUNCTION(timezone_name_from_abbr) } /* }}} */ -/* {{{ proto long timezone_offset_get(DateTimeZone object, DateTime object) +/* {{{ proto long timezone_offset_get(DateTimeZone object, DateTimeInterface datetime) Returns the timezone offset. */ PHP_FUNCTION(timezone_offset_get) @@ -3808,13 +3808,13 @@ PHP_FUNCTION(timezone_offset_get) php_date_obj *dateobj; timelib_time_offset *offset; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_timezone, &dateobject, date_ce_date) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OO", &object, date_ce_timezone, &dateobject, date_ce_interface) == FAILURE) { RETURN_FALSE; } tzobj = Z_PHPTIMEZONE_P(object); DATE_CHECK_INITIALIZED(tzobj->initialized, DateTimeZone); dateobj = Z_PHPDATE_P(dateobject); - DATE_CHECK_INITIALIZED(dateobj->time, DateTime); + DATE_CHECK_INITIALIZED(dateobj->time, DateTimeInterface); switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: diff --git a/ext/date/tests/014.phpt b/ext/date/tests/014.phpt index 3adb32c965..1580f1ae70 100644 --- a/ext/date/tests/014.phpt +++ b/ext/date/tests/014.phpt @@ -37,6 +37,4 @@ Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on li bool(false) int(0) -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d -bool(false) -Done +Catchable fatal error: Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of DateTime given in %s diff --git a/ext/date/tests/68062.phpt b/ext/date/tests/68062.phpt new file mode 100644 index 0000000000..ce2105abae --- /dev/null +++ b/ext/date/tests/68062.phpt @@ -0,0 +1,13 @@ +--TEST-- +DateTimeZone::getOffset() accepts a DateTimeInterface object +--FILE-- +<?php + +$tz = new DateTimeZone('Europe/London'); +$dt = new DateTimeImmutable('2014-09-20', $tz); + +echo $tz->getOffset($dt); +echo $tz->getOffset(1); +--EXPECTF-- +3600 +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s diff --git a/ext/date/tests/DateTimeZone_getOffset_variation1.phpt b/ext/date/tests/DateTimeZone_getOffset_variation1.phpt index a86d5e10bb..ecd99d5bc3 100644 --- a/ext/date/tests/DateTimeZone_getOffset_variation1.phpt +++ b/ext/date/tests/DateTimeZone_getOffset_variation1.phpt @@ -112,141 +112,141 @@ fclose( $file_handle ); -- int 0 -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d bool(false) -- int 1 -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d bool(false) -- int 12345 -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d bool(false) -- int -12345 -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, integer given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, integer given in %s on line %d bool(false) -- float 10.5 -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, double given in %s on line %d bool(false) -- float -10.5 -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, double given in %s on line %d bool(false) -- float .5 -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, double given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, double given in %s on line %d bool(false) -- empty array -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d bool(false) -- int indexed array -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d bool(false) -- associative array -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d bool(false) -- nested arrays -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, array given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, array given in %s on line %d bool(false) -- uppercase NULL -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d bool(false) -- lowercase null -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d bool(false) -- lowercase true -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d bool(false) -- lowercase false -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d bool(false) -- uppercase TRUE -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d bool(false) -- uppercase FALSE -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, boolean given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, boolean given in %s on line %d bool(false) -- empty string DQ -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d bool(false) -- empty string SQ -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d bool(false) -- string DQ -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d bool(false) -- string SQ -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d bool(false) -- mixed case string -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d bool(false) -- heredoc -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, string given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, string given in %s on line %d bool(false) -- instance of classWithToString -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, object given in %s on line %d bool(false) -- instance of classWithoutToString -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, object given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, object given in %s on line %d bool(false) -- undefined var -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d bool(false) -- unset var -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, null given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, null given in %s on line %d bool(false) -- resource -- -Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTime, resource given in %s on line %d +Warning: DateTimeZone::getOffset() expects parameter 1 to be DateTimeInterface, resource given in %s on line %d bool(false) ===DONE=== diff --git a/ext/date/tests/bug67118.phpt b/ext/date/tests/bug67118.phpt index 332142856e..7b5d6a7328 100644 --- a/ext/date/tests/bug67118.phpt +++ b/ext/date/tests/bug67118.phpt @@ -23,5 +23,6 @@ class mydt extends datetime new mydt("Funktionsansvarig rÄdgivning och juridik", "UTC"); ?> --EXPECTF-- + Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %s on line %d Bad date diff --git a/ext/date/tests/timezone_offset_get_error.phpt b/ext/date/tests/timezone_offset_get_error.phpt index b8ca2c1c15..9e9daacf84 100644 --- a/ext/date/tests/timezone_offset_get_error.phpt +++ b/ext/date/tests/timezone_offset_get_error.phpt @@ -1,5 +1,5 @@ --TEST-- -Test timezone_offset_get() function : error conditions +Test timezone_offset_get() function : error conditions --FILE-- <?php /* Prototype : int timezone_offset_get ( DateTimeZone $object , DateTime $datetime ) @@ -7,12 +7,20 @@ Test timezone_offset_get() function : error conditions * Source code: ext/date/php_date.c * Alias to functions: DateTimeZone::getOffset */ - -//Set the default time zone + +//Set the default time zone date_default_timezone_set("GMT"); $tz = timezone_open("Europe/London"); $date = date_create("GMT"); - + +set_error_handler('err'); + +function err($errno, $errstr) { + if ($errno === E_RECOVERABLE_ERROR) { + var_dump($errstr); + } +} + echo "*** Testing timezone_offset_get() : error conditions ***\n"; echo "\n-- Testing timezone_offset_get() function with zero arguments --\n"; @@ -27,7 +35,7 @@ var_dump( timezone_offset_get($tz, $date, $extra_arg) ); echo "\n-- Testing timezone_offset_get() function with an invalid values for \$object argument --\n"; $invalid_obj = new stdClass(); -var_dump( timezone_offset_get($invalid_obj, $date) ); +var_dump( timezone_offset_get($invalid_obj, $date) ); $invalid_obj = 10; var_dump( timezone_offset_get($invalid_obj, $date) ); $invalid_obj = null; @@ -35,50 +43,38 @@ var_dump( timezone_offset_get($invalid_obj, $date) ); echo "\n-- Testing timezone_offset_get() function with an invalid values for \$datetime argument --\n"; $invalid_obj = new stdClass(); -var_dump( timezone_offset_get($tz, $invalid_obj) ); +var_dump( timezone_offset_get($tz, $invalid_obj) ); $invalid_obj = 10; var_dump( timezone_offset_get($tz, $invalid_obj) ); $invalid_obj = null; -var_dump( timezone_offset_get($tz, $invalid_obj) ); +var_dump( timezone_offset_get($tz, $invalid_obj) ); ?> ===DONE=== --EXPECTF-- *** Testing timezone_offset_get() : error conditions *** -- Testing timezone_offset_get() function with zero arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 0 given in %s on line %d bool(false) -- Testing timezone_offset_get() function with less than expected no. of arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 1 given in %s on line %d bool(false) -- Testing timezone_offset_get() function with more than expected no. of arguments -- - -Warning: timezone_offset_get() expects exactly 2 parameters, 3 given in %s on line %d bool(false) -- Testing timezone_offset_get() function with an invalid values for $object argument -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d +string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of stdClass given" bool(false) - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d +string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given" bool(false) - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d +string(%d) "Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given" bool(false) -- Testing timezone_offset_get() function with an invalid values for $datetime argument -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d +string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of stdClass given" bool(false) - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d +string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given" bool(false) - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d +string(%d) "Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given" bool(false) ===DONE=== diff --git a/ext/date/tests/timezone_offset_get_variation1.phpt b/ext/date/tests/timezone_offset_get_variation1.phpt index 5fd5e8b270..01013ab5cd 100644 --- a/ext/date/tests/timezone_offset_get_variation1.phpt +++ b/ext/date/tests/timezone_offset_get_variation1.phpt @@ -13,6 +13,14 @@ echo "*** Testing timezone_offset_get() : usage variation - unexpected values t //Set the default time zone date_default_timezone_set("Europe/London"); +set_error_handler('handler'); + +function handler($errno, $errstr) { + if ($errno === E_RECOVERABLE_ERROR) { + echo $errstr . "\n"; + } +} + //get an unset variable $unset_var = 10; unset ($unset_var); @@ -111,142 +119,114 @@ fclose( $file_handle ); *** Testing timezone_offset_get() : usage variation - unexpected values to first argument $object*** -- int 0 -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given bool(false) -- int 1 -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given bool(false) -- int 12345 -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given bool(false) -- int -12345 -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, integer given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, integer given bool(false) -- float 10.5 -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, double given bool(false) -- float -10.5 -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, double given bool(false) -- float .5 -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, double given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, double given bool(false) -- empty array -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given bool(false) -- int indexed array -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given bool(false) -- associative array -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given bool(false) -- nested arrays -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, array given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, array given bool(false) -- uppercase NULL -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given bool(false) -- lowercase null -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given bool(false) -- lowercase true -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given bool(false) -- lowercase false -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given bool(false) -- uppercase TRUE -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given bool(false) -- uppercase FALSE -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, boolean given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, boolean given bool(false) -- empty string DQ -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given bool(false) -- empty string SQ -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given bool(false) -- string DQ -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given bool(false) -- string SQ -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given bool(false) -- mixed case string -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given bool(false) -- heredoc -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, string given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, string given bool(false) -- instance of classWithToString -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of classWithToString given bool(false) -- instance of classWithoutToString -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, object given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, instance of classWithoutToString given bool(false) -- undefined var -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given bool(false) -- unset var -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, null given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, null given bool(false) -- resource -- - -Warning: timezone_offset_get() expects parameter 1 to be DateTimeZone, resource given in %s on line %d +Argument 1 passed to timezone_offset_get() must be an instance of DateTimeZone, resource given bool(false) ===DONE=== diff --git a/ext/date/tests/timezone_offset_get_variation2.phpt b/ext/date/tests/timezone_offset_get_variation2.phpt index 93311f3a6b..98e1093514 100644 --- a/ext/date/tests/timezone_offset_get_variation2.phpt +++ b/ext/date/tests/timezone_offset_get_variation2.phpt @@ -13,6 +13,14 @@ echo "*** Testing timezone_offset_get() : usage variation - unexpected values t //Set the default time zone date_default_timezone_set("Europe/London"); +set_error_handler('handler'); + +function handler($errno, $errstr) { + if ($errno === E_RECOVERABLE_ERROR) { + echo $errstr . "\n"; + } +} + //get an unset variable $unset_var = 10; unset ($unset_var); @@ -111,142 +119,114 @@ fclose( $file_handle ); *** Testing timezone_offset_get() : usage variation - unexpected values to second argument $datetime*** -- int 0 -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given bool(false) -- int 1 -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given bool(false) -- int 12345 -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given bool(false) -- int -12345 -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, integer given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, integer given bool(false) -- float 10.5 -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, double given bool(false) -- float -10.5 -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, double given bool(false) -- float .5 -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, double given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, double given bool(false) -- empty array -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given bool(false) -- int indexed array -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given bool(false) -- associative array -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given bool(false) -- nested arrays -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, array given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, array given bool(false) -- uppercase NULL -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given bool(false) -- lowercase null -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given bool(false) -- lowercase true -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given bool(false) -- lowercase false -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given bool(false) -- uppercase TRUE -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given bool(false) -- uppercase FALSE -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, boolean given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, boolean given bool(false) -- empty string DQ -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given bool(false) -- empty string SQ -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given bool(false) -- string DQ -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given bool(false) -- string SQ -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given bool(false) -- mixed case string -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given bool(false) -- heredoc -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given bool(false) -- instance of classWithToString -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of classWithToString given bool(false) -- instance of classWithoutToString -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, object given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, instance of classWithoutToString given bool(false) -- undefined var -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given bool(false) -- unset var -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, null given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, null given bool(false) -- resource -- - -Warning: timezone_offset_get() expects parameter 2 to be DateTime, resource given in %s on line %d +Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, resource given bool(false) ===DONE=== diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 869bd3ccba..f43802647b 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -616,7 +616,7 @@ static void zend_optimize_block(zend_code_block *block, zend_op_array *op_array, VAR_SOURCE(opline->op1)->opcode == ZEND_QM_ASSIGN && ZEND_OP1_TYPE(VAR_SOURCE(opline->op1)) == IS_CONST && opline->opcode != ZEND_CASE && /* CASE _always_ expects variable */ - opline->opcode != ZEND_FETCH_DIM_TMP_VAR && /* in 5.1, FETCH_DIM_TMP_VAR expects T */ + opline->opcode != ZEND_FETCH_LIST && /* in 5.1, FETCH_DIM_TMP_VAR expects T */ opline->opcode != ZEND_FE_RESET && opline->opcode != ZEND_FREE ) { diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index cd75817e0c..70e58f5695 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -244,7 +244,7 @@ void zend_optimizer_update_op2_const(zend_op_array *op_array, case ZEND_FETCH_DIM_IS: case ZEND_FETCH_DIM_FUNC_ARG: case ZEND_FETCH_DIM_UNSET: - case ZEND_FETCH_DIM_TMP_VAR: + case ZEND_FETCH_LIST: check_numeric: { zend_ulong index; diff --git a/ext/phar/phar.c b/ext/phar/phar.c index a0c99c5f40..e3b663a011 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -2068,54 +2068,6 @@ static int php_check_dots(const char *element, int n) /* {{{ */ #define IS_BACKSLASH(c) ((c) == '/') -#ifdef COMPILE_DL_PHAR -/* stupid-ass non-extern declaration in tsrm_strtok.h breaks dumbass MS compiler */ -static inline int in_character_class(char ch, const char *delim) /* {{{ */ -{ - while (*delim) { - if (*delim == ch) { - return 1; - } - ++delim; - } - return 0; -} -/* }}} */ - -char *tsrm_strtok_r(char *s, const char *delim, char **last) /* {{{ */ -{ - char *token; - - if (s == NULL) { - s = *last; - } - - while (*s && in_character_class(*s, delim)) { - ++s; - } - - if (!*s) { - return NULL; - } - - token = s; - - while (*s && !in_character_class(*s, delim)) { - ++s; - } - - if (!*s) { - *last = s; - } else { - *s = '\0'; - *last = s + 1; - } - - return token; -} -/* }}} */ -#endif - /** * Remove .. and . references within a phar filename */ diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index fc279e2d12..d6c37e37fb 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -6046,7 +6046,7 @@ ZEND_END_ARG_INFO() static const zend_function_entry reflection_zend_extension_functions[] = { ZEND_ME(reflection, __clone, arginfo_reflection__void, ZEND_ACC_PRIVATE|ZEND_ACC_FINAL) ZEND_ME(reflection_zend_extension, export, arginfo_reflection_extension_export, ZEND_ACC_STATIC|ZEND_ACC_PUBLIC) - ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_extension___construct, 0) + ZEND_ME(reflection_zend_extension, __construct, arginfo_reflection_zend_extension___construct, 0) ZEND_ME(reflection_zend_extension, __toString, arginfo_reflection__void, 0) ZEND_ME(reflection_zend_extension, getName, arginfo_reflection__void, 0) ZEND_ME(reflection_zend_extension, getVersion, arginfo_reflection__void, 0) diff --git a/sapi/phpdbg/phpdbg_opcode.c b/sapi/phpdbg/phpdbg_opcode.c index 125a85fe72..f33b1378bf 100644 --- a/sapi/phpdbg/phpdbg_opcode.c +++ b/sapi/phpdbg/phpdbg_opcode.c @@ -280,7 +280,7 @@ const char *phpdbg_decode_opcode(zend_uchar opcode) /* {{{ */ CASE(ZEND_FETCH_UNSET); CASE(ZEND_FETCH_DIM_UNSET); CASE(ZEND_FETCH_OBJ_UNSET); - CASE(ZEND_FETCH_DIM_TMP_VAR); + CASE(ZEND_FETCH_LIST); CASE(ZEND_FETCH_CONSTANT); CASE(ZEND_GOTO); CASE(ZEND_EXT_STMT); diff --git a/tests/lang/passByReference_005.phpt b/tests/lang/passByReference_005.phpt index 52ddeebd1c..b90f0ce912 100644 --- a/tests/lang/passByReference_005.phpt +++ b/tests/lang/passByReference_005.phpt @@ -144,7 +144,7 @@ var_dump($u1, $u2); ?> --EXPECTF-- - ---- Pass by ref / pass by val: functions ---- +---- Pass by ref / pass by val: functions ---- Notice: Undefined variable: u1 in %s on line 72 @@ -179,40 +179,40 @@ string(12) "Ref2 changed" ---- Pass by ref / pass by val: static method calls ---- -Notice: Undefined variable: u1 in %s on line 95 - Strict Standards: Non-static method C::v() should not be called statically in %s on line 95 +Notice: Undefined variable: u1 in %s on line 95 + Strict Standards: Non-static method C::r() should not be called statically in %s on line 96 Notice: Undefined variable: u1 in %s on line 97 NULL string(11) "Ref changed" +Strict Standards: Non-static method C::vv() should not be called statically in %s on line 100 + Notice: Undefined variable: u1 in %s on line 100 Notice: Undefined variable: u2 in %s on line 100 -Strict Standards: Non-static method C::vv() should not be called statically in %s on line 100 - Notice: Undefined variable: u1 in %s on line 101 Notice: Undefined variable: u2 in %s on line 101 NULL NULL -Notice: Undefined variable: u1 in %s on line 104 - Strict Standards: Non-static method C::vr() should not be called statically in %s on line 104 +Notice: Undefined variable: u1 in %s on line 104 + Notice: Undefined variable: u1 in %s on line 105 NULL string(11) "Ref changed" -Notice: Undefined variable: u2 in %s on line 108 - Strict Standards: Non-static method C::rv() should not be called statically in %s on line 108 +Notice: Undefined variable: u2 in %s on line 108 + Notice: Undefined variable: u2 in %s on line 109 string(11) "Ref changed" NULL @@ -258,4 +258,4 @@ Notice: Undefined variable: u2 in %s on line 135 string(11) "Ref changed" NULL string(12) "Ref1 changed" -string(12) "Ref2 changed"
\ No newline at end of file +string(12) "Ref2 changed" |