cvs: ZendEngine2(PHP_5_3) / zend_vm_def.h zend_vm_execute.h
[email protected] ("Hannes Magnusson")
| Newsgroups | php.zend-engine.cvs |
|---|---|
| Message-ID | <cvsbjori1202744773@cvsserver> |
bjori Mon Feb 11 15:46:13 2008 UTC
Modified files: (Branch: PHP_5_3)
/ZendEngine2 zend_vm_def.h zend_vm_execute.h
Log:
Fix segfaults when calling "ctors statically"
bjori-20080211154613.txt
(text/plain, 13.6 KB)
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_def.h?r1=1.59.2.29.2.48.2.35&r2=1.59.2.29.2.48.2.36&diff_format=u
Index: ZendEngine2/zend_vm_def.h
diff -u ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.35 ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.36
--- ZendEngine2/zend_vm_def.h:1.59.2.29.2.48.2.35 Sat Feb 2 15:48:04 2008
+++ ZendEngine2/zend_vm_def.h Mon Feb 11 15:46:10 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.35 2008/02/02 15:48:04 helly Exp $ */
+/* $Id: zend_vm_def.h,v 1.59.2.29.2.48.2.36 2008/02/11 15:46:10 bjori Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
@@ -1963,8 +1963,7 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (OP2_TYPE != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_vm_execute.h?r1=1.62.2.30.2.49.2.34&r2=1.62.2.30.2.49.2.35&diff_format=u
Index: ZendEngine2/zend_vm_execute.h
diff -u ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.34 ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.35
--- ZendEngine2/zend_vm_execute.h:1.62.2.30.2.49.2.34 Thu Jan 24 18:07:45 2008
+++ ZendEngine2/zend_vm_execute.h Mon Feb 11 15:46:10 2008
@@ -148,6 +148,7 @@
zend_error(E_STRICT, "Non-static method %s::%s() should not be called statically", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
} 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", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
}
}
@@ -2432,13 +2433,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_CONST != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -2993,13 +3003,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_TMP_VAR != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -3449,13 +3468,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_VAR != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -3662,13 +3690,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_UNUSED != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -4086,13 +4123,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_CV != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -9931,13 +9977,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_CONST != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -11732,13 +11787,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_TMP_VAR != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -13503,13 +13567,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_VAR != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -14387,13 +14460,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_UNUSED != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {
@@ -15859,13 +15941,22 @@
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
- if (IS_CV != IS_UNUSED &&
- EG(This) &&
+ if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!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))) {