diff options
author | Christopher Jones <sixd@php.net> | 2013-09-02 05:40:51 -0700 |
---|---|---|
committer | Christopher Jones <sixd@php.net> | 2013-09-02 05:40:51 -0700 |
commit | d532ffae4247b1594c30735435fa212b2f9f499b (patch) | |
tree | 71cb86562008a76490a128a1bd6a01b4643bc6bb | |
parent | d7ffca590b4ee188a5dcdbafb036e6541f3c79be (diff) | |
parent | 825c1f239b3432e76299c1dba0869df2b57b4c0d (diff) | |
download | php-git-d532ffae4247b1594c30735435fa212b2f9f499b.tar.gz |
Merge branch 'master' of https://git.php.net/repository/php-src
* 'master' of https://git.php.net/repository/php-src:
Typo....
Add a XFAIL test for #64896
Implement phase 1 of rfc/incompat_ctx
Make use of direct returns in some places
Always pass return_value_ptr to internal functions
-rw-r--r-- | UPGRADING.INTERNALS | 15 | ||||
-rw-r--r-- | Zend/tests/bug64896.phpt | 47 | ||||
-rw-r--r-- | Zend/tests/incompat_ctx_user.phpt | 20 | ||||
-rw-r--r-- | Zend/zend_API.h | 12 | ||||
-rw-r--r-- | Zend/zend_closures.c | 10 | ||||
-rw-r--r-- | Zend/zend_execute.c | 16 | ||||
-rw-r--r-- | Zend/zend_execute_API.c | 4 | ||||
-rw-r--r-- | Zend/zend_generators.c | 8 | ||||
-rw-r--r-- | Zend/zend_object_handlers.c | 14 | ||||
-rw-r--r-- | Zend/zend_vm_def.h | 4 | ||||
-rw-r--r-- | Zend/zend_vm_execute.h | 22 | ||||
-rw-r--r-- | ext/standard/array.c | 21 |
12 files changed, 139 insertions, 54 deletions
diff --git a/UPGRADING.INTERNALS b/UPGRADING.INTERNALS index 566f310998..7cb5539fc1 100644 --- a/UPGRADING.INTERNALS +++ b/UPGRADING.INTERNALS @@ -4,6 +4,7 @@ UPGRADE NOTES - PHP X.Y 1. Internal API changes a. Addition of do_operation and compare object handlers + b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros 2. Build system changes a. Unix build system changes @@ -43,6 +44,20 @@ UPGRADE NOTES - PHP X.Y Further docs in the RFC: https://wiki.php.net/rfc/operator_overloading_gmp + b. return_value_ptr now always available, RETVAL_ZVAL_FAST macros + + The return_value_ptr argument to internal functions is now always set. + Previously it was only available for functions returning by-reference. + return_value_ptr can now be used to return zvals without copying them. + For this purpose two new macros are provided: + + RETVAL_ZVAL_FAST(zv); /* analog to RETVAL_ZVAL(zv, 1, 0) */ + RETURN_ZVAL_FAST(zv); /* analog to RETURN_ZVAL(zv, 1, 0) */ + + The macros behave similarly to the non-FAST variants with copy=1 and + dtor=0, but will try to return the zval without making a copy by utilizing + return_value_ptr. + ======================== 2. Build system changes ======================== diff --git a/Zend/tests/bug64896.phpt b/Zend/tests/bug64896.phpt new file mode 100644 index 0000000000..3e955bbece --- /dev/null +++ b/Zend/tests/bug64896.phpt @@ -0,0 +1,47 @@ +--TEST-- +Bug #64896 (Segfault with gc_collect_cycles using unserialize on certain objects) +--XFAIL-- +We can not fix this bug without a significant (performace slow down) change to gc +--FILE-- +<?php +$bar = NULL; +class bad +{ + private $_private = array(); + + public function __construct() + { + $this->_private[] = 'php'; + } + + public function __destruct() + { + global $bar; + $bar = $this; + } +} + +$foo = new stdclass; +$foo->foo = $foo; +$foo->bad = new bad; + +gc_disable(); + +unserialize(serialize($foo)); +gc_collect_cycles(); +var_dump($bar); +/* will output: +object(bad)#4 (1) { + ["_private":"bad":private]=> + &UNKNOWN:0 +} +*/ +?> +--EXPECTF-- +bject(bad)#%d (1) { + ["_private":"bad":private]=> + array(1) { + [0]=> + string(3) "php" + } +} diff --git a/Zend/tests/incompat_ctx_user.phpt b/Zend/tests/incompat_ctx_user.phpt new file mode 100644 index 0000000000..2d9b59c1e8 --- /dev/null +++ b/Zend/tests/incompat_ctx_user.phpt @@ -0,0 +1,20 @@ +--TEST-- +Incompatible context call (non-internal function) +--INI-- +error_reporting=E_ALL +--FILE-- +<?php + +class A { + function foo() { var_dump(get_class($this)); } +} +class B { + function bar() { A::foo(); } +} +$b = new B; +$b->bar(); + +?> +--EXPECTF-- +Deprecated: Non-static method A::foo() should not be called statically, assuming $this from incompatible context in %s on line %d +string(1) "B" diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 1a7c66e906..16e766d8a5 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -636,6 +636,18 @@ END_EXTERN_C() #define RETURN_FALSE { RETVAL_FALSE; return; } #define RETURN_TRUE { RETVAL_TRUE; return; } +#define RETVAL_ZVAL_FAST(z) do { \ + zval *_z = (z); \ + if (Z_ISREF_P(_z)) { \ + RETVAL_ZVAL(_z, 1, 0); \ + } else { \ + zval_ptr_dtor(&return_value); \ + Z_ADDREF_P(_z); \ + *return_value_ptr = _z; \ + } \ +} while (0) +#define RETURN_ZVAL_FAST(z) { RETVAL_ZVAL_FAST(z); return; } + #define SET_VAR_STRING(n, v) { \ { \ zval *var; \ diff --git a/Zend/zend_closures.c b/Zend/zend_closures.c index 5faefbd224..fcad86f171 100644 --- a/Zend/zend_closures.c +++ b/Zend/zend_closures.c @@ -59,14 +59,8 @@ ZEND_METHOD(Closure, __invoke) /* {{{ */ } else if (call_user_function_ex(CG(function_table), NULL, this_ptr, &closure_result_ptr, ZEND_NUM_ARGS(), arguments, 1, NULL TSRMLS_CC) == FAILURE) { RETVAL_FALSE; } else if (closure_result_ptr) { - if (Z_ISREF_P(closure_result_ptr) && return_value_ptr) { - if (return_value) { - zval_ptr_dtor(&return_value); - } - *return_value_ptr = closure_result_ptr; - } else { - RETVAL_ZVAL(closure_result_ptr, 1, 1); - } + zval_ptr_dtor(&return_value); + *return_value_ptr = closure_result_ptr; } efree(arguments); diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 3c3dd8e3b0..048c1fc184 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1487,15 +1487,17 @@ ZEND_API opcode_handler_t *zend_opcode_handlers; ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC) { - if(fci != NULL) { - ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(fci->param_count, - *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); - + if (fci != NULL) { + execute_data_ptr->function_state.function->internal_function.handler( + fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, + fci->object_ptr, 1 TSRMLS_CC + ); } else { zval **return_value_ptr = &EX_TMP_VAR(execute_data_ptr, execute_data_ptr->opline->result.var)->var.ptr; - ((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, *return_value_ptr, - (execute_data_ptr->function_state.function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)?return_value_ptr:NULL, - execute_data_ptr->object, return_value_used TSRMLS_CC); + execute_data_ptr->function_state.function->internal_function.handler( + execute_data_ptr->opline->extended_value, *return_value_ptr, return_value_ptr, + execute_data_ptr->object, return_value_used TSRMLS_CC + ); } } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 83c2217984..0b29086a0d 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -952,9 +952,9 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS if (EX(function_state).function->common.scope) { EG(scope) = EX(function_state).function->common.scope; } - if(EXPECTED(zend_execute_internal == NULL)) { + if (EXPECTED(zend_execute_internal == NULL)) { /* saves one function call if zend_execute_internal is not used */ - ((zend_internal_function *) EX(function_state).function)->handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); + EX(function_state).function->internal_function.handler(fci->param_count, *fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC); } else { zend_execute_internal(&execute_data, fci, 1 TSRMLS_CC); } diff --git a/Zend/zend_generators.c b/Zend/zend_generators.c index 1a805bbd6d..c6b211ae4d 100644 --- a/Zend/zend_generators.c +++ b/Zend/zend_generators.c @@ -430,7 +430,7 @@ ZEND_METHOD(Generator, current) zend_generator_ensure_initialized(generator TSRMLS_CC); if (generator->value) { - RETURN_ZVAL(generator->value, 1, 0); + RETURN_ZVAL_FAST(generator->value); } } /* }}} */ @@ -450,7 +450,7 @@ ZEND_METHOD(Generator, key) zend_generator_ensure_initialized(generator TSRMLS_CC); if (generator->key) { - RETURN_ZVAL(generator->key, 1, 0); + RETURN_ZVAL_FAST(generator->key); } } /* }}} */ @@ -499,7 +499,7 @@ ZEND_METHOD(Generator, send) zend_generator_resume(generator TSRMLS_CC); if (generator->value) { - RETURN_ZVAL(generator->value, 1, 0); + RETURN_ZVAL_FAST(generator->value); } } /* }}} */ @@ -532,7 +532,7 @@ ZEND_METHOD(Generator, throw) zend_generator_resume(generator TSRMLS_CC); if (generator->value) { - RETURN_ZVAL(generator->value, 1, 0); + RETURN_ZVAL_FAST(generator->value); } } else { /* If the generator is already closed throw the exception in the diff --git a/Zend/zend_object_handlers.c b/Zend/zend_object_handlers.c index 921e0d798a..8beacdfd35 100644 --- a/Zend/zend_object_handlers.c +++ b/Zend/zend_object_handlers.c @@ -896,11 +896,8 @@ ZEND_API void zend_std_call_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ */ zend_call_method_with_2_params(&this_ptr, ce, &ce->__call, ZEND_CALL_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr); if (method_result_ptr) { - if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) { - RETVAL_ZVAL(method_result_ptr, 1, 1); - } else { - RETVAL_ZVAL(method_result_ptr, 0, 1); - } + RETVAL_ZVAL_FAST(method_result_ptr); + zval_ptr_dtor(&method_result_ptr); } /* now destruct all auxiliaries */ @@ -1113,11 +1110,8 @@ ZEND_API void zend_std_callstatic_user_call(INTERNAL_FUNCTION_PARAMETERS) /* {{{ zend_call_method_with_2_params(NULL, ce, &ce->__callstatic, ZEND_CALLSTATIC_FUNC_NAME, &method_result_ptr, method_name_ptr, method_args_ptr); if (method_result_ptr) { - if (Z_ISREF_P(method_result_ptr) || Z_REFCOUNT_P(method_result_ptr) > 1) { - RETVAL_ZVAL(method_result_ptr, 1, 1); - } else { - RETVAL_ZVAL(method_result_ptr, 0, 1); - } + RETVAL_ZVAL_FAST(method_result_ptr); + zval_ptr_dtor(&method_result_ptr); } /* now destruct all auxiliaries */ diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h index 7e4f7a897d..2bc80faa4e 100644 --- a/Zend/zend_vm_def.h +++ b/Zend/zend_vm_def.h @@ -1990,7 +1990,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY) if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ - fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); + fbc->internal_function.handler(opline->extended_value, ret->var.ptr, &ret->var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { zend_execute_internal(execute_data, NULL, RETURN_VALUE_USED(opline) TSRMLS_CC); } @@ -2609,7 +2609,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, CONST|VAR, CONST|TMP|VAR|UNUS /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h index 5f2c8055a0..08fb847382 100644 --- a/Zend/zend_vm_execute.h +++ b/Zend/zend_vm_execute.h @@ -551,7 +551,7 @@ static int ZEND_FASTCALL zend_do_fcall_common_helper_SPEC(ZEND_OPCODE_HANDLER_AR if (!zend_execute_internal) { /* saves one function call if zend_execute_internal is not used */ - fbc->internal_function.handler(opline->extended_value, ret->var.ptr, (fbc->common.fn_flags & ZEND_ACC_RETURN_REFERENCE) ? &ret->var.ptr : NULL, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); + fbc->internal_function.handler(opline->extended_value, ret->var.ptr, &ret->var.ptr, EX(object), RETURN_VALUE_USED(opline) TSRMLS_CC); } else { zend_execute_internal(execute_data, NULL, RETURN_VALUE_USED(opline) TSRMLS_CC); } @@ -3661,7 +3661,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CONST_HANDLER( /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -4654,7 +4654,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_TMP_HANDLER(ZE /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -5512,7 +5512,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_VAR_HANDLER(ZE /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -6232,7 +6232,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_UNUSED_HANDLER /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -7092,7 +7092,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_CONST_CV_HANDLER(ZEN /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -15561,7 +15561,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZE /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -17914,7 +17914,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_TMP_HANDLER(ZEND /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -20227,7 +20227,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_VAR_HANDLER(ZEND /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -21667,7 +21667,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_UNUSED_HANDLER(Z /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); @@ -23685,7 +23685,7 @@ static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CV_HANDLER(ZEND_ /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ if (call->fbc->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); + zend_error(E_DEPRECATED, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", call->fbc->common.scope->name, call->fbc->common.function_name); } 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", call->fbc->common.scope->name, call->fbc->common.function_name); diff --git a/ext/standard/array.c b/ext/standard/array.c index 51972033ee..ae6e5d266f 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -830,7 +830,7 @@ PHP_FUNCTION(end) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -853,7 +853,7 @@ PHP_FUNCTION(prev) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -876,7 +876,7 @@ PHP_FUNCTION(next) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -899,7 +899,7 @@ PHP_FUNCTION(reset) RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + RETURN_ZVAL_FAST(*entry); } } /* }}} */ @@ -918,7 +918,8 @@ PHP_FUNCTION(current) if (zend_hash_get_current_data(array, (void **) &entry) == FAILURE) { RETURN_FALSE; } - RETURN_ZVAL(*entry, 1, 0); + + RETURN_ZVAL_FAST(*entry); } /* }}} */ @@ -958,7 +959,7 @@ PHP_FUNCTION(min) RETVAL_NULL(); } else { if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 0, (void **) &result TSRMLS_CC) == SUCCESS) { - RETVAL_ZVAL(*result, 1, 0); + RETVAL_ZVAL_FAST(*result); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element"); RETVAL_FALSE; @@ -978,7 +979,7 @@ PHP_FUNCTION(min) } } - RETVAL_ZVAL(*min, 1, 0); + RETVAL_ZVAL_FAST(*min); } if (args) { @@ -1009,7 +1010,7 @@ PHP_FUNCTION(max) RETVAL_NULL(); } else { if (zend_hash_minmax(Z_ARRVAL_PP(args[0]), php_array_data_compare, 1, (void **) &result TSRMLS_CC) == SUCCESS) { - RETVAL_ZVAL(*result, 1, 0); + RETVAL_ZVAL_FAST(*result); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Array must contain at least one element"); RETVAL_FALSE; @@ -1029,7 +1030,7 @@ PHP_FUNCTION(max) } } - RETVAL_ZVAL(*max, 1, 0); + RETVAL_ZVAL_FAST(*max); } if (args) { @@ -1955,7 +1956,7 @@ static void _phpi_pop(INTERNAL_FUNCTION_PARAMETERS, int off_the_end) zend_hash_internal_pointer_reset(Z_ARRVAL_P(stack)); } zend_hash_get_current_data(Z_ARRVAL_P(stack), (void **)&val); - RETVAL_ZVAL(*val, 1, 0); + RETVAL_ZVAL_FAST(*val); /* Delete the first or last value */ zend_hash_get_current_key_ex(Z_ARRVAL_P(stack), &key, &key_len, &index, 0, NULL); |