*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);
}
}
}
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);
}
}
!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))) {