cvs: ZendEngine2(PHP_5_2) / zend_vm_def.h zend_vm_execute.h /tests bug46381.phpt

From: Date: Fri, 24 Oct 2008 13:55:39 +0000
Subject: cvs: ZendEngine2(PHP_5_2) / zend_vm_def.h zend_vm_execute.h /tests bug46381.phpt
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-7169@lists.php.net to get a copy of this message
tony2001 Fri Oct 24 13:55:39 2008 UTC Added files: (Branch: PHP_5_2) /ZendEngine2/tests bug46381.phpt Modified files: /ZendEngine2 zend_vm_def.h zend_vm_execute.h Log: fix bug #46381 (wrong $this passed to internal methods causes segfault) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.58&r2=1.59.2.29.2.59&diff_format=u Index: ZendEngine2/zend_vm_def.h diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.58 ZendEngine2/zend_vm_def.h:1.59.2.29.2.59 --- ZendEngine2/zend_vm_def.h:1.59.2.29.2.58 Wed Aug 13 07:19:40 2008 +++ ZendEngine2/zend_vm_def.h Fri Oct 24 13:55:35 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_vm_def.h,v 1.59.2.29.2.58 2008/08/13 07:19:40 dmitry Exp $ */ +/* $Id: zend_vm_def.h,v 1.59.2.29.2.59 2008/10/24 13:55:35 tony2001 Exp $ */ /* If you change this file, please regenerate the zend_vm_execute.h and * zend_vm_opcodes.h files by running: @@ -1825,7 +1825,17 @@ !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 { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + 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))) { http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.61&r2=1.62.2.30.2.62&diff_format=u Index: ZendEngine2/zend_vm_execute.h diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.61 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.62 --- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.61 Wed Aug 13 07:19:40 2008 +++ ZendEngine2/zend_vm_execute.h Fri Oct 24 13:55:35 2008 @@ -710,7 +710,17 @@ !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 { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + 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))) { @@ -911,7 +921,17 @@ !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 { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + 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))) { @@ -1072,7 +1092,17 @@ !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 { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + 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))) { @@ -1232,7 +1262,17 @@ !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 { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + 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))) { @@ -1325,7 +1365,17 @@ !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 { + /* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */ + 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))) { http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug46381.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/bug46381.phpt +++ ZendEngine2/tests/bug46381.phpt

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