}
/* }}} */
-static void zend_check_magic_method_attr(uint32_t attr, const char* method) /* {{{ */
+static void zend_check_magic_method_attr(uint32_t attr, const char* method, zend_bool is_static) /* {{{ */
{
- if (memcmp(method, "__callStatic", sizeof("__callStatic") - 1) == 0) {
+ if (is_static) {
if (!(attr & ZEND_ACC_PUBLIC) || !(attr & ZEND_ACC_STATIC)) {
- zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static");
+ zend_error(E_WARNING, "The magic method %s() must have public visibility and be static");
}
} else if (!(attr & ZEND_ACC_PUBLIC) || (attr & ZEND_ACC_STATIC)) {
zend_error(E_WARNING,
} else if (zend_string_equals_literal(lcname, ZEND_CLONE_FUNC_NAME)) {
ce->clone = (zend_function *) op_array;
} else if (zend_string_equals_literal(lcname, ZEND_CALL_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__call");
+ zend_check_magic_method_attr(fn_flags, "__call", 0);
ce->__call = (zend_function *) op_array;
} else if (zend_string_equals_literal(lcname, ZEND_CALLSTATIC_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__callStatic");
+ zend_check_magic_method_attr(fn_flags, "__callStatic", 1);
ce->__callstatic = (zend_function *) op_array;
} else if (zend_string_equals_literal(lcname, ZEND_GET_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__get");
+ zend_check_magic_method_attr(fn_flags, "__get", 0);
ce->__get = (zend_function *) op_array;
ce->ce_flags |= ZEND_ACC_USE_GUARDS;
} else if (zend_string_equals_literal(lcname, ZEND_SET_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__set");
+ zend_check_magic_method_attr(fn_flags, "__set", 0);
ce->__set = (zend_function *) op_array;
ce->ce_flags |= ZEND_ACC_USE_GUARDS;
} else if (zend_string_equals_literal(lcname, ZEND_UNSET_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__unset");
+ zend_check_magic_method_attr(fn_flags, "__unset", 0);
ce->__unset = (zend_function *) op_array;
ce->ce_flags |= ZEND_ACC_USE_GUARDS;
} else if (zend_string_equals_literal(lcname, ZEND_ISSET_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__isset");
+ zend_check_magic_method_attr(fn_flags, "__isset", 0);
ce->__isset = (zend_function *) op_array;
ce->ce_flags |= ZEND_ACC_USE_GUARDS;
} else if (zend_string_equals_literal(lcname, ZEND_TOSTRING_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__toString");
+ zend_check_magic_method_attr(fn_flags, "__toString", 0);
ce->__tostring = (zend_function *) op_array;
} else if (zend_string_equals_literal(lcname, ZEND_INVOKE_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__invoke");
+ zend_check_magic_method_attr(fn_flags, "__invoke", 0);
} else if (zend_string_equals_literal(lcname, ZEND_DEBUGINFO_FUNC_NAME)) {
- zend_check_magic_method_attr(fn_flags, "__debugInfo");
+ zend_check_magic_method_attr(fn_flags, "__debugInfo", 0);
ce->__debugInfo = (zend_function *) op_array;
}