}
/* }}} */
-static struct _zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zval *member, int silent, ulong h TSRMLS_DC) /* {{{ */
+static struct _zend_property_info *zend_get_property_info_quick(zend_class_entry *ce, zval *member, int silent, const zend_literal *key TSRMLS_DC) /* {{{ */
{
- zend_property_info *property_info = NULL;
+ zend_property_info *property_info;
zend_property_info *scope_property_info;
zend_bool denied_access = 0;
+ ulong h;
- if (Z_STRVAL_P(member)[0] == '\0') {
+ if (UNEXPECTED(Z_STRVAL_P(member)[0] == '\0')) {
if (!silent) {
if (Z_STRLEN_P(member) == 0) {
- zend_error(E_ERROR, "Cannot access empty property");
+ zend_error_noreturn(E_ERROR, "Cannot access empty property");
} else {
- zend_error(E_ERROR, "Cannot access property started with '\\0'");
+ zend_error_noreturn(E_ERROR, "Cannot access property started with '\\0'");
}
}
return NULL;
}
+ property_info = NULL;
+ h = key ? key->hash_value : zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
if (zend_hash_quick_find(&ce->properties_info, Z_STRVAL_P(member), Z_STRLEN_P(member)+1, h, (void **) &property_info)==SUCCESS) {
- if(property_info->flags & ZEND_ACC_SHADOW) {
+ if (UNEXPECTED((property_info->flags & ZEND_ACC_SHADOW) != 0)) {
/* if it's a shadow - go to access it's private */
property_info = NULL;
} else {
- if (zend_verify_property_access(property_info, ce TSRMLS_CC)) {
- if (property_info->flags & ZEND_ACC_CHANGED
- && !(property_info->flags & ZEND_ACC_PRIVATE)) {
+ if (EXPECTED(zend_verify_property_access(property_info, ce TSRMLS_CC) != 0)) {
+ if (EXPECTED((property_info->flags & ZEND_ACC_CHANGED) != 0)
+ && EXPECTED(!(property_info->flags & ZEND_ACC_PRIVATE))) {
/* We still need to make sure that we're not in a context
* where the right property is a different 'statically linked' private
* continue checking below...
&& scope_property_info->flags & ZEND_ACC_PRIVATE) {
return scope_property_info;
} else if (property_info) {
- if (denied_access) {
+ if (UNEXPECTED(denied_access != 0)) {
/* Information was available, but we were denied access. Error out. */
- if (silent) {
- return NULL;
+ if (!silent) {
+ zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, Z_STRVAL_P(member));
}
- zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, Z_STRVAL_P(member));
+ return NULL;
} else {
/* fall through, return property_info... */
}
ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce, zval *member, int silent TSRMLS_DC) /* {{{ */
{
- zend_ulong h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
-
- return zend_get_property_info_quick(ce, member, silent, h TSRMLS_CC);
+ return zend_get_property_info_quick(ce, member, silent, NULL TSRMLS_CC);
}
/* }}} */
zend_unmangle_property_name(prop_info_name, prop_info_name_len, &class_name, &prop_name);
ZVAL_STRING(&member, prop_name, 0);
- property_info = zend_get_property_info(zobj->ce, &member, 1 TSRMLS_CC);
+ property_info = zend_get_property_info_quick(zobj->ce, &member, 1, NULL TSRMLS_CC);
if (!property_info) {
return FAILURE;
}
silent = (type == BP_VAR_IS);
zobj = Z_OBJ_P(object);
- if (Z_TYPE_P(member) != IS_STRING) {
- ALLOC_ZVAL(tmp_member);
+ if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
+ ALLOC_ZVAL(tmp_member);
*tmp_member = *member;
INIT_PZVAL(tmp_member);
zval_copy_ctor(tmp_member);
#endif
/* make zend_get_property_info silent if we have getter - we may want to use it */
- if (key) {
- property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key->hash_value TSRMLS_CC);
- } else {
- property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__get != NULL) TSRMLS_CC);
- }
+ property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key TSRMLS_CC);
- if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
+ if (UNEXPECTED(!property_info) ||
+ UNEXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE)) {
zend_guard *guard;
if (zobj->ce->__get &&
Z_UNSET_ISREF_P(rv);
Z_SET_REFCOUNT_P(rv, 0);
}
- if (Z_TYPE_P(rv) != IS_OBJECT) {
+ if (UNEXPECTED(Z_TYPE_P(rv) != IS_OBJECT)) {
zend_error(E_NOTICE, "Indirect modification of overloaded property %s::$%s has no effect", zobj->ce->name, Z_STRVAL_P(member));
}
}
retval = &EG(uninitialized_zval_ptr);
}
}
- if (tmp_member) {
+ if (UNEXPECTED(tmp_member != NULL)) {
Z_ADDREF_PP(retval);
zval_ptr_dtor(&tmp_member);
Z_DELREF_PP(retval);
zobj = Z_OBJ_P(object);
- if (Z_TYPE_P(member) != IS_STRING) {
+ if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
ALLOC_ZVAL(tmp_member);
*tmp_member = *member;
INIT_PZVAL(tmp_member);
key = NULL;
}
- if (key) {
- property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__set != NULL), key->hash_value TSRMLS_CC);
- } else {
- property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__set != NULL) TSRMLS_CC);
- }
+ property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__set != NULL), key TSRMLS_CC);
- if (property_info && zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &variable_ptr) == SUCCESS) {
+ if (EXPECTED(property_info != NULL) &&
+ EXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &variable_ptr) == SUCCESS)) {
/* if we already have this value there, we don't actually need to do anything */
- if (*variable_ptr != value) {
+ if (EXPECTED(*variable_ptr != value)) {
/* if we are assigning reference, we shouldn't move it, but instead assign variable
to the same pointer */
if (PZVAL_IS_REF(*variable_ptr)) {
}
}
- if (tmp_member) {
+ if (UNEXPECTED(tmp_member != NULL)) {
zval_ptr_dtor(&tmp_member);
}
}
zend_class_entry *ce = Z_OBJCE_P(object);
zval *retval;
- if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
+ if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
if(offset == NULL) {
/* [] construct */
ALLOC_INIT_ZVAL(offset);
zval_ptr_dtor(&offset);
- if (!retval) {
- if (!EG(exception)) {
- zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name);
+ if (UNEXPECTED(!retval)) {
+ if (UNEXPECTED(!EG(exception))) {
+ zend_error_noreturn(E_ERROR, "Undefined offset for object of type %s used as array", ce->name);
}
return 0;
}
return retval;
} else {
- zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
return 0;
}
}
{
zend_class_entry *ce = Z_OBJCE_P(object);
- if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
+ if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
if (!offset) {
ALLOC_INIT_ZVAL(offset);
} else {
zend_call_method_with_2_params(&object, ce, NULL, "offsetset", NULL, offset, value);
zval_ptr_dtor(&offset);
} else {
- zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
}
}
/* }}} */
zval *retval;
int result;
- if (instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC)) {
+ if (EXPECTED(instanceof_function_ex(ce, zend_ce_arrayaccess, 1 TSRMLS_CC) != 0)) {
SEPARATE_ARG_IF_REF(offset);
zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset);
- if (retval) {
+ if (EXPECTED(retval != NULL)) {
result = i_zend_is_true(retval);
zval_ptr_dtor(&retval);
- if (check_empty && result && !EG(exception)) {
+ if (check_empty && result && EXPECTED(!EG(exception))) {
zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset);
if (retval) {
result = i_zend_is_true(retval);
}
zval_ptr_dtor(&offset);
} else {
- zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
return 0;
}
return result;
zobj = Z_OBJ_P(object);
- if (Z_TYPE_P(member) != IS_STRING) {
+ if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
tmp_member = *member;
zval_copy_ctor(&tmp_member);
convert_to_string(&tmp_member);
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
#endif
- if (key) {
- property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key->hash_value TSRMLS_CC);
- } else {
- property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__get != NULL) TSRMLS_CC);
- }
+ property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__get != NULL), key TSRMLS_CC);
- if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
+ if (UNEXPECTED(!property_info) ||
+ UNEXPECTED(zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE)) {
zval *new_zval;
zend_guard *guard;
retval = NULL;
}
}
- if (member == &tmp_member) {
+ if (UNEXPECTED(member == &tmp_member)) {
zval_dtor(member);
}
return retval;
zobj = Z_OBJ_P(object);
- if (Z_TYPE_P(member) != IS_STRING) {
+ if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
ALLOC_ZVAL(tmp_member);
*tmp_member = *member;
INIT_PZVAL(tmp_member);
key = NULL;
}
- if (key) {
- property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__unset != NULL), key->hash_value TSRMLS_CC);
- } else {
- property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__unset != NULL) TSRMLS_CC);
- }
+ property_info = zend_get_property_info_quick(zobj->ce, member, (zobj->ce->__unset != NULL), key TSRMLS_CC);
- if (!property_info || zend_hash_quick_del(zobj->properties, property_info->name, property_info->name_length+1, property_info->h) == FAILURE) {
+ if (UNEXPECTED(!property_info) ||
+ UNEXPECTED(zend_hash_quick_del(zobj->properties, property_info->name, property_info->name_length+1, property_info->h) == FAILURE)) {
zend_guard *guard;
if (zobj->ce->__unset &&
}
}
- if (tmp_member) {
+ if (UNEXPECTED(tmp_member != NULL)) {
zval_ptr_dtor(&tmp_member);
}
}
zend_call_method_with_1_params(&object, ce, NULL, "offsetunset", NULL, offset);
zval_ptr_dtor(&offset);
} else {
- zend_error(E_ERROR, "Cannot use object of type %s as array", ce->name);
+ zend_error_noreturn(E_ERROR, "Cannot use object of type %s as array", ce->name);
}
}
/* }}} */
INIT_PZVAL(method_args_ptr);
array_init_size(method_args_ptr, ZEND_NUM_ARGS());
- if (zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE) {
+ if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE)) {
zval_dtor(method_args_ptr);
- zend_error(E_ERROR, "Cannot get arguments for __call");
+ zend_error_noreturn(E_ERROR, "Cannot get arguments for __call");
RETURN_FALSE;
}
char *lc_method_name;
ALLOCA_FLAG(use_heap)
- if (key) {
+ if (EXPECTED(key != NULL)) {
lc_method_name = Z_STRVAL(key->constant);
hash_value = key->hash_value;
} else {
hash_value = zend_hash_func(lc_method_name, method_len+1);
}
- if (zend_hash_quick_find(&zobj->ce->function_table, lc_method_name, method_len+1, hash_value, (void **)&fbc) == FAILURE) {
- if (!key) {
+ if (UNEXPECTED(zend_hash_quick_find(&zobj->ce->function_table, lc_method_name, method_len+1, hash_value, (void **)&fbc) == FAILURE)) {
+ if (UNEXPECTED(!key)) {
free_alloca(lc_method_name, use_heap);
}
if (zobj->ce->__call) {
* If we're not and __call() handler exists, invoke it, otherwise error out.
*/
updated_fbc = zend_check_private_int(fbc, Z_OBJ_HANDLER_P(object, get_class_entry)(object TSRMLS_CC), lc_method_name, method_len, hash_value TSRMLS_CC);
- if (updated_fbc) {
+ if (EXPECTED(updated_fbc != NULL)) {
fbc = updated_fbc;
} else {
if (zobj->ce->__call) {
fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
} else {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
}
}
} else {
/* Ensure that if we're calling a protected function, we're allowed to do so.
* If we're not and __call() handler exists, invoke it, otherwise error out.
*/
- if (!zend_check_protected(zend_get_function_root_class(fbc), EG(scope))) {
+ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(fbc), EG(scope)))) {
if (zobj->ce->__call) {
fbc = zend_get_user_call_function(zobj->ce, method_name, method_len);
} else {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), method_name, EG(scope) ? EG(scope)->name : "");
}
}
}
}
- if (!key) {
+ if (UNEXPECTED(!key)) {
free_alloca(lc_method_name, use_heap);
}
return fbc;
INIT_PZVAL(method_args_ptr);
array_init_size(method_args_ptr, ZEND_NUM_ARGS());
- if (zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE) {
+ if (UNEXPECTED(zend_copy_parameters_array(ZEND_NUM_ARGS(), method_args_ptr TSRMLS_CC) == FAILURE)) {
zval_dtor(method_args_ptr);
- zend_error(E_ERROR, "Cannot get arguments for " ZEND_CALLSTATIC_FUNC_NAME);
+ zend_error_noreturn(E_ERROR, "Cannot get arguments for " ZEND_CALLSTATIC_FUNC_NAME);
RETURN_FALSE;
}
ulong hash_value;
ALLOCA_FLAG(use_heap)
- if (key) {
+ if (EXPECTED(key != NULL)) {
lc_function_name = Z_STRVAL(key->constant);
hash_value = key->hash_value;
} else {
}
efree(lc_class_name);
}
- if (!fbc && zend_hash_quick_find(&ce->function_table, lc_function_name, function_name_strlen+1, hash_value, (void **) &fbc)==FAILURE) {
- if (!key) {
+ if (EXPECTED(!fbc) &&
+ UNEXPECTED(zend_hash_quick_find(&ce->function_table, lc_function_name, function_name_strlen+1, hash_value, (void **) &fbc)==FAILURE)) {
+ if (UNEXPECTED(!key)) {
free_alloca(lc_function_name, use_heap);
}
#if MBO_0
/* right now this function is used for non static method lookup too */
/* Is the function static */
- if (!(fbc->common.fn_flags & ZEND_ACC_STATIC)) {
- zend_error(E_ERROR, "Cannot call non static method %s::%s() without object", ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name);
+ if (UNEXPECTED(!(fbc->common.fn_flags & ZEND_ACC_STATIC))) {
+ zend_error_noreturn(E_ERROR, "Cannot call non static method %s::%s() without object", ZEND_FN_SCOPE_NAME(fbc), fbc->common.function_name);
}
#endif
if (fbc->op_array.fn_flags & ZEND_ACC_PUBLIC) {
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
updated_fbc = zend_check_private_int(fbc, EG(scope), lc_function_name, function_name_strlen, hash_value TSRMLS_CC);
- if (updated_fbc) {
+ if (EXPECTED(updated_fbc != NULL)) {
fbc = updated_fbc;
} else {
if (ce->__callstatic) {
fbc = zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
} else {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
}
}
} else if ((fbc->common.fn_flags & ZEND_ACC_PROTECTED)) {
/* Ensure that if we're calling a protected function, we're allowed to do so.
*/
- if (!zend_check_protected(zend_get_function_root_class(fbc), EG(scope))) {
+ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(fbc), EG(scope)))) {
if (ce->__callstatic) {
fbc = zend_get_user_callstatic_function(ce, function_name_strval, function_name_strlen);
} else {
- zend_error(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
+ zend_error_noreturn(E_ERROR, "Call to %s method %s::%s() from context '%s'", zend_visibility_string(fbc->common.fn_flags), ZEND_FN_SCOPE_NAME(fbc), function_name_strval, EG(scope) ? EG(scope)->name : "");
}
}
}
- if (!key) {
+ if (UNEXPECTED(!key)) {
free_alloca(lc_function_name, use_heap);
}
zend_property_info std_property_info;
ulong hash_value;
- if (key) {
+ if (EXPECTED(key != NULL)) {
hash_value = key->hash_value;
} else {
hash_value = zend_hash_func(property_name, property_name_len+1);
}
- if (zend_hash_quick_find(&ce->properties_info, property_name, property_name_len+1, hash_value, (void **) &property_info)==FAILURE) {
+ if (UNEXPECTED(zend_hash_quick_find(&ce->properties_info, property_name, property_name_len+1, hash_value, (void **) &property_info)==FAILURE)) {
std_property_info.flags = ZEND_ACC_PUBLIC;
std_property_info.name = property_name;
std_property_info.name_length = property_name_len;
zend_printf("Access type for %s::%s is %s\n", ce->name, property_name, zend_visibility_string(property_info->flags));
#endif
- if (!zend_verify_property_access(property_info, ce TSRMLS_CC)) {
+ if (UNEXPECTED(!zend_verify_property_access(property_info, ce TSRMLS_CC))) {
if (!silent) {
- zend_error(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, property_name);
+ zend_error_noreturn(E_ERROR, "Cannot access %s property %s::$%s", zend_visibility_string(property_info->flags), ce->name, property_name);
}
return NULL;
}
zend_hash_quick_find(CE_STATIC_MEMBERS(tmp_ce), property_info->name, property_info->name_length+1, property_info->h, (void **) &retval);
- if (!retval) {
- if (silent) {
- return NULL;
- } else {
- zend_error(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name, property_name);
+ if (UNEXPECTED(!retval)) {
+ if (!silent) {
+ zend_error_noreturn(E_ERROR, "Access to undeclared static property: %s::$%s", ce->name, property_name);
}
+ return NULL;
}
return retval;
ZEND_API zend_bool zend_std_unset_static_property(zend_class_entry *ce, char *property_name, int property_name_len, const zend_literal *key TSRMLS_DC) /* {{{ */
{
- zend_error(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name);
+ zend_error_noreturn(E_ERROR, "Attempt to unset static property %s::$%s", ce->name, property_name);
return 0;
}
/* }}} */
} else if (constructor->op_array.fn_flags & ZEND_ACC_PRIVATE) {
/* Ensure that if we're calling a private function, we're allowed to do so.
*/
- if (constructor->common.scope != EG(scope)) {
+ if (UNEXPECTED(constructor->common.scope != EG(scope))) {
if (EG(scope)) {
- zend_error(E_ERROR, "Call to private %s::%s() from context '%s'", constructor->common.scope->name, constructor->common.function_name, EG(scope)->name);
+ zend_error_noreturn(E_ERROR, "Call to private %s::%s() from context '%s'", constructor->common.scope->name, constructor->common.function_name, EG(scope)->name);
} else {
- zend_error(E_ERROR, "Call to private %s::%s() from invalid context", constructor->common.scope->name, constructor->common.function_name);
+ zend_error_noreturn(E_ERROR, "Call to private %s::%s() from invalid context", constructor->common.scope->name, constructor->common.function_name);
}
}
} else if ((constructor->common.fn_flags & ZEND_ACC_PROTECTED)) {
* Constructors only have prototype if they are defined by an interface but
* it is the compilers responsibility to take care of the prototype.
*/
- if (!zend_check_protected(zend_get_function_root_class(constructor), EG(scope))) {
+ if (UNEXPECTED(!zend_check_protected(zend_get_function_root_class(constructor), EG(scope)))) {
if (EG(scope)) {
- zend_error(E_ERROR, "Call to protected %s::%s() from context '%s'", constructor->common.scope->name, constructor->common.function_name, EG(scope)->name);
+ zend_error_noreturn(E_ERROR, "Call to protected %s::%s() from context '%s'", constructor->common.scope->name, constructor->common.function_name, EG(scope)->name);
} else {
- zend_error(E_ERROR, "Call to protected %s::%s() from invalid context", constructor->common.scope->name, constructor->common.function_name);
+ zend_error_noreturn(E_ERROR, "Call to protected %s::%s() from invalid context", constructor->common.scope->name, constructor->common.function_name);
}
}
}
zobj = Z_OBJ_P(object);
- if (Z_TYPE_P(member) != IS_STRING) {
+ if (UNEXPECTED(Z_TYPE_P(member) != IS_STRING)) {
ALLOC_ZVAL(tmp_member);
*tmp_member = *member;
INIT_PZVAL(tmp_member);
fprintf(stderr, "Read object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
#endif
- if (key) {
- property_info = zend_get_property_info_quick(zobj->ce, member, 1, key->hash_value TSRMLS_CC);
- } else {
- property_info = zend_get_property_info(zobj->ce, member, 1 TSRMLS_CC);
- }
+ property_info = zend_get_property_info_quick(zobj->ce, member, 1, key TSRMLS_CC);
- if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &value) == FAILURE) {
+ if (UNEXPECTED(!property_info) ||
+ zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &value) == FAILURE) {
zend_guard *guard;
result = 0;
result = zend_is_true(rv);
zval_ptr_dtor(&rv);
if (has_set_exists && result) {
- if (!EG(exception) && zobj->ce->__get && !guard->in_get) {
+ if (EXPECTED(!EG(exception)) && zobj->ce->__get && !guard->in_get) {
guard->in_get = 1;
rv = zend_std_call_getter(object, member TSRMLS_CC);
guard->in_get = 0;
}
}
- if (tmp_member) {
+ if (UNEXPECTED(tmp_member != NULL)) {
zval_ptr_dtor(&tmp_member);
}
return result;
ce = Z_OBJCE_P(readobj);
if (ce->__tostring &&
(zend_call_method_with_0_params(&readobj, ce, &ce->__tostring, "__tostring", &retval) || EG(exception))) {
- if (EG(exception)) {
+ if (UNEXPECTED(EG(exception) != NULL)) {
if (retval) {
zval_ptr_dtor(&retval);
}
- zend_error(E_ERROR, "Method %s::__toString() must not throw an exception", ce->name);
+ zend_error_noreturn(E_ERROR, "Method %s::__toString() must not throw an exception", ce->name);
return FAILURE;
}
- if (Z_TYPE_P(retval) == IS_STRING) {
+ if (EXPECTED(Z_TYPE_P(retval) == IS_STRING)) {
INIT_PZVAL(writeobj);
if (readobj == writeobj) {
zval_dtor(readobj);
SAVE_OPLINE();
if (UNEXPECTED((EX_T(opline->op1.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_IMPLICIT_ABSTRACT_CLASS|ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) != 0)) {
- char *class_type;
-
if (EX_T(opline->op1.var).class_entry->ce_flags & ZEND_ACC_INTERFACE) {
- class_type = "interface";
+ zend_error_noreturn(E_ERROR, "Cannot instantiate interface %s", EX_T(opline->op1.var).class_entry->name);
} else if ((EX_T(opline->op1.var).class_entry->ce_flags & ~ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) & ZEND_ACC_TRAIT) {
- class_type = "trait";
+ zend_error_noreturn(E_ERROR, "Cannot instantiate trait %s", EX_T(opline->op1.var).class_entry->name);
} else {
- class_type = "abstract class";
+ zend_error_noreturn(E_ERROR, "Cannot instantiate abstract class %s", EX_T(opline->op1.var).class_entry->name);
}
- zend_error_noreturn(E_ERROR, "Cannot instantiate %s %s", class_type, EX_T(opline->op1.var).class_entry->name);
}
ALLOC_ZVAL(object_zval);
object_init_ex(object_zval, EX_T(opline->op1.var).class_entry);
zend_do_implement_trait(ce, trait TSRMLS_CC);
}
+ CHECK_EXCEPTION();
ZEND_VM_NEXT_OPCODE();
}
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));
!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. */
- int severity;
- char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
- severity = E_STRICT;
- verb = "should not";
+ 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);
} 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_noreturn(E_ERROR, "Non-static method %s::%s() cannot be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name);
}
- 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))) {
Z_ADDREF_P(EX(object));