Commit: d515455589d836e709a65590e14d85575bdd2766
Author: Gustavo André dos Santos Lopes <cataphr...@php.net> Mon, 2
Sep 2013 01:53:06 +0200
Parents: 47ee470992014c738891d05b5acc89c2de90f2ac
Branches: master
Link:
http://git.php.net/?p=php-src.git;a=commitdiff;h=d515455589d836e709a65590e14d85575bdd2766
Log:
Implement phase 1 of rfc/incompat_ctx
Just changing the error level of the message from E_STRICT to
E_DEPRECATED. This comes one version later than the timeline
mentioned in the RFC.
Oddly, there were no tests for this ‘feature’. I added a simple
one.
Changed paths:
A Zend/tests/incompat_ctx_user.phpt
M Zend/zend_vm_def.h
M Zend/zend_vm_execute.h
diff --git a/Zend/tests/incompat_ctx_user.phpt
b/Zend/tests/incompat_ctx_user.phpt
new file mode 100644
index 0000000..2d9b59c
--- /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_vm_def.h b/Zend/zend_vm_def.h
index 4ab2129..2bc80fa 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -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 0ea5fc4..08fb847 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -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);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php