cvs: ZendEngine2(PHP_5_3) / zend_API.c zend_execute_API.c zend_vm_def.h

From: Date: Sat, 02 Feb 2008 13:57:00 +0000
Subject: cvs: ZendEngine2(PHP_5_3) / zend_API.c zend_execute_API.c zend_vm_def.h
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-6340@lists.php.net to get a copy of this message
helly Sat Feb 2 13:57:00 2008 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2 zend_API.c zend_execute_API.c zend_vm_def.h Log: - Fix flag handling in message generation http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.296.2.27.2.34.2.20&r2=1.296.2.27.2.34.2.21&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.296.2.27.2.34.2.20 ZendEngine2/zend_API.c:1.296.2.27.2.34.2.21 --- ZendEngine2/zend_API.c:1.296.2.27.2.34.2.20 Sat Feb 2 01:12:01 2008 +++ ZendEngine2/zend_API.c Sat Feb 2 13:56:59 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.296.2.27.2.34.2.20 2008/02/02 01:12:01 rasmus Exp $ */ +/* $Id: zend_API.c,v 1.296.2.27.2.34.2.21 2008/02/02 13:56:59 helly Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2400,21 +2400,30 @@ *fptr_ptr = fptr; if (*ce_ptr) { if (!*zobj_ptr_ptr && !(fptr->common.fn_flags & ZEND_ACC_STATIC)) { + int severity; + char *verb; + if (fptr->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + severity = E_ERROR; + verb = "cannot"; + } if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0) { retval = 0; } if (EG(This) && instanceof_function(Z_OBJCE_P(EG(This)), *ce_ptr TSRMLS_CC)) { *zobj_ptr_ptr = &EG(This); if (error) { - zend_spprintf(error, 0, "non-static method %s::%s() cannot be called statically, assuming $this from compatible context %s", (*ce_ptr)->name, fptr->common.function_name, Z_OBJCE_P(EG(This))->name); + zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", (*ce_ptr)->name, fptr->common.function_name, verb, Z_OBJCE_P(EG(This))->name); } else if (retval) { - zend_error(E_STRICT, "Non-static method %s::%s() cannot be called statically, assuming $this from compatible context %s", (*ce_ptr)->name, fptr->common.function_name, Z_OBJCE_P(EG(This))->name); + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s", (*ce_ptr)->name, fptr->common.function_name, verb, Z_OBJCE_P(EG(This))->name); } } else { if (error) { - zend_spprintf(error, 0, "non-static method %s::%s() should not be called statically", (*ce_ptr)->name, fptr->common.function_name); + zend_spprintf(error, 0, "non-static method %s::%s() %s be called statically", (*ce_ptr)->name, fptr->common.function_name, verb); } else if (retval) { - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", (*ce_ptr)->name, fptr->common.function_name); + zend_error(severity, "Non-static method %s::%s() %s be called statically", (*ce_ptr)->name, fptr->common.function_name, verb); } } } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.331.2.20.2.24.2.23&r2=1.331.2.20.2.24.2.24&diff_format=u Index: ZendEngine2/zend_execute_API.c diff -u ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.23 ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.24 --- ZendEngine2/zend_execute_API.c:1.331.2.20.2.24.2.23 Tue Jan 29 11:12:57 2008 +++ ZendEngine2/zend_execute_API.c Sat Feb 2 13:56:59 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.23 2008/01/29 11:12:57 dmitry Exp $ */ +/* $Id: zend_execute_API.c,v 1.331.2.20.2.24.2.24 2008/02/02 13:56:59 helly Exp $ */ #include <stdio.h> #include <signal.h> @@ -1046,12 +1046,15 @@ EG(This) = NULL; if (calling_scope && !(EX(function_state).function->common.fn_flags & ZEND_ACC_STATIC)) { int severity; + char *verb; if (EX(function_state).function->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { severity = E_STRICT; + verb = "should not"; } else { severity = E_ERROR; + verb = "cannot"; } - zend_error(severity, "Non-static method %s::%s() cannot be called statically", calling_scope->name, EX(function_state).function->common.function_name); + zend_error(severity, "Non-static method %s::%s() %s be called statically", calling_scope->name, EX(function_state).function->common.function_name, verb); } } http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.33&r2=1.59.2.29.2.48.2.34&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.33 ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.34 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.33 Thu Jan 24 18:07:45 2008 +++ ZendEngine2/zend_vm_def.h Sat Feb 2 13:56:59 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.33 2008/01/24 18:07:45 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.34 2008/02/02 13:56:59 helly Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1969,7 +1969,16 @@ !instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) { /* We are calling method of the other (incompatible) class, but passing $this. This is done for compatibility with php-4. */ - zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name); + int severity; + char *verb; + if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) { + severity = E_STRICT; + verb = "should not"; + } else { + severity = E_ERROR; + verb = "cannot"; + } + zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb); } if ((EX(object) = EG(This))) {

« previous php.zend-engine.cvs (#6340) next »