mirror of
https://github.com/php/php-src.git
synced 2026-04-20 22:41:20 +02:00
Fixed error messages
This commit is contained in:
@@ -3534,9 +3534,9 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
|
||||
&& parent->common.scope != (child->common.prototype ? child->common.prototype->common.scope : child->common.scope)
|
||||
&& child->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_IMPLEMENTED_ABSTRACT)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Can't inherit abstract function %s::%s() (previously declared abstract in %s)",
|
||||
parent->common.scope->name,
|
||||
child->common.function_name,
|
||||
child->common.prototype ? child->common.prototype->common.scope->name : child->common.scope->name);
|
||||
parent->common.scope->name->val,
|
||||
child->common.function_name->val,
|
||||
child->common.prototype ? child->common.prototype->common.scope->name->val : child->common.scope->name->val);
|
||||
}
|
||||
|
||||
if (parent_flags & ZEND_ACC_FINAL) {
|
||||
@@ -3548,15 +3548,15 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
|
||||
*/
|
||||
if ((child_flags & ZEND_ACC_STATIC) != (parent_flags & ZEND_ACC_STATIC)) {
|
||||
if (child->common.fn_flags & ZEND_ACC_STATIC) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non static method %s::%s() static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
|
||||
} else {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make static method %s::%s() non static in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
|
||||
}
|
||||
}
|
||||
|
||||
/* Disallow making an inherited method abstract. */
|
||||
if ((child_flags & ZEND_ACC_ABSTRACT) && !(parent_flags & ZEND_ACC_ABSTRACT)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name, ZEND_FN_SCOPE_NAME(child));
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Cannot make non abstract method %s::%s() abstract in class %s", ZEND_FN_SCOPE_NAME(parent), child->common.function_name->val, ZEND_FN_SCOPE_NAME(child));
|
||||
}
|
||||
|
||||
if (parent_flags & ZEND_ACC_CHANGED) {
|
||||
@@ -3565,7 +3565,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
|
||||
/* Prevent derived classes from restricting access that was available in parent classes
|
||||
*/
|
||||
if ((child_flags & ZEND_ACC_PPP_MASK) > (parent_flags & ZEND_ACC_PPP_MASK)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Access level to %s::%s() must be %s (as in class %s)%s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_visibility_string(parent_flags), ZEND_FN_SCOPE_NAME(parent), (parent_flags&ZEND_ACC_PUBLIC) ? "" : " or weaker");
|
||||
} else if (((child_flags & ZEND_ACC_PPP_MASK) < (parent_flags & ZEND_ACC_PPP_MASK))
|
||||
&& ((parent_flags & ZEND_ACC_PPP_MASK) & ZEND_ACC_PRIVATE)) {
|
||||
child->common.fn_flags |= ZEND_ACC_CHANGED;
|
||||
@@ -3584,7 +3584,7 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
|
||||
|
||||
if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
|
||||
if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) {
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_get_function_declaration(child->common.prototype TSRMLS_CC));
|
||||
zend_error_noreturn(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name->val, zend_get_function_declaration(child->common.prototype TSRMLS_CC));
|
||||
}
|
||||
} else if (EG(error_reporting) & E_STRICT || Z_TYPE(EG(user_error_handler)) != IS_UNDEF) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */
|
||||
if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) {
|
||||
|
||||
Reference in New Issue
Block a user