From: Felipe Pena Date: Tue, 10 Jun 2008 23:09:09 +0000 (+0000) Subject: - Change E_COMPILE_ERROR to E_WARNING (for wrong visibility on magic methods) X-Git-Tag: BEFORE_NEW_PARAMETER_PARSE~41 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dc697bcea48ee79a6becf2462b6023cce5a6d2b3;p=php - Change E_COMPILE_ERROR to E_WARNING (for wrong visibility on magic methods) --- diff --git a/Zend/tests/magic_methods_002.phpt b/Zend/tests/magic_methods_002.phpt index da29aaa3a0..1e8305e237 100644 --- a/Zend/tests/magic_methods_002.phpt +++ b/Zend/tests/magic_methods_002.phpt @@ -11,4 +11,4 @@ class foo { ?> --EXPECTF-- -Fatal error: The magic method __unset() must have public visibility and can not be static in %s on line %d +Warning: The magic method __unset() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_003.phpt b/Zend/tests/magic_methods_003.phpt index 25802223c4..1118a23ba0 100644 --- a/Zend/tests/magic_methods_003.phpt +++ b/Zend/tests/magic_methods_003.phpt @@ -11,4 +11,4 @@ class foo { ?> --EXPECTF-- -Fatal error: The magic method __unset() must have public visibility and can not be static in %s on line %d +Warning: The magic method __unset() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_004.phpt b/Zend/tests/magic_methods_004.phpt index c75e454395..0ac332cb36 100644 --- a/Zend/tests/magic_methods_004.phpt +++ b/Zend/tests/magic_methods_004.phpt @@ -11,4 +11,4 @@ class foo { ?> --EXPECTF-- -Fatal error: The magic method __unset() must have public visibility and can not be static in %s on line %d +Warning: The magic method __unset() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_005.phpt b/Zend/tests/magic_methods_005.phpt index 2cf84dc997..8e8bb4e8a2 100644 --- a/Zend/tests/magic_methods_005.phpt +++ b/Zend/tests/magic_methods_005.phpt @@ -9,4 +9,4 @@ interface a { ?> --EXPECTF-- -Fatal error: The magic method __call() must have public visibility and can not be static in %s on line %d +Warning: The magic method __call() must have public visibility and can not be static in %s on line %d diff --git a/Zend/tests/magic_methods_006.phpt b/Zend/tests/magic_methods_006.phpt index 3fdab062b0..2e84a41c5c 100644 --- a/Zend/tests/magic_methods_006.phpt +++ b/Zend/tests/magic_methods_006.phpt @@ -9,4 +9,4 @@ interface a { ?> --EXPECTF-- -Fatal error: The magic method __callStatic() must have public visibility and be static in %s on line %d +Warning: The magic method __callStatic() must have public visibility and be static in %s on line %d diff --git a/Zend/tests/magic_methods_007.phpt b/Zend/tests/magic_methods_007.phpt index 0f3b9e521d..d949c95aec 100644 --- a/Zend/tests/magic_methods_007.phpt +++ b/Zend/tests/magic_methods_007.phpt @@ -9,4 +9,6 @@ abstract class b { ?> --EXPECTF-- -Fatal error: The magic method __set() must have public visibility and can not be static in %s on line %d +Warning: The magic method __set() must have public visibility and can not be static in %s on line %d + +Fatal error: Method b::__set() must take exactly 2 arguments in %s on line %d diff --git a/Zend/tests/magic_methods_008.phpt b/Zend/tests/magic_methods_008.phpt index b3f7362493..3d9b69728d 100644 --- a/Zend/tests/magic_methods_008.phpt +++ b/Zend/tests/magic_methods_008.phpt @@ -14,4 +14,6 @@ class a extends b { ?> --EXPECTF-- -Fatal error: The magic method __set() must have public visibility and can not be static in %s on line %d +Warning: The magic method __set() must have public visibility and can not be static in %s on line %d + +Fatal error: Access level to a::__set() must be public (as in class b) in %s on line %d diff --git a/Zend/tests/magic_methods_009.phpt b/Zend/tests/magic_methods_009.phpt index aac3d4c6ca..2b514c3bff 100644 --- a/Zend/tests/magic_methods_009.phpt +++ b/Zend/tests/magic_methods_009.phpt @@ -10,4 +10,4 @@ class a { ?> --EXPECTF-- -Fatal error: The magic method __callStatic() must have public visibility and be static in %s on line %d +Warning: The magic method __callStatic() must have public visibility and be static in %s on line %d diff --git a/Zend/tests/magic_methods_010.phpt b/Zend/tests/magic_methods_010.phpt index 33e6b873ff..d50b357242 100644 --- a/Zend/tests/magic_methods_010.phpt +++ b/Zend/tests/magic_methods_010.phpt @@ -10,4 +10,6 @@ class a { ?> --EXPECTF-- -Fatal error: The magic method __toString() must have public visibility and can not be static in %s on line %d +Warning: The magic method __toString() must have public visibility and can not be static in %s on line %d + +Fatal error: Method a::__tostring() cannot take arguments in %s on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index aaeb6500d9..da0757bb97 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -1206,31 +1206,31 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n if (CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE) { if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __call() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __call() must have public visibility and can not be static"); } } else if ((name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) { if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) { - zend_error(E_COMPILE_ERROR, "The magic method __callStatic() must have public visibility and be static"); + zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static"); } } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __get() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __get() must have public visibility and can not be static"); } } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __set() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __set() must have public visibility and can not be static"); } } else if ((name_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __unset() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __unset() must have public visibility and can not be static"); } } else if ((name_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __isset() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __isset() must have public visibility and can not be static"); } } else if ((name_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __toString() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __toString() must have public visibility and can not be static"); } } } else { @@ -1266,37 +1266,37 @@ void zend_do_begin_function_declaration(znode *function_token, znode *function_n CG(active_class_entry)->clone = (zend_function *) CG(active_op_array); } else if ((name_len == sizeof(ZEND_CALL_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __call() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __call() must have public visibility and can not be static"); } CG(active_class_entry)->__call = (zend_function *) CG(active_op_array); } else if ((name_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1))) { if ((fn_flags & (ZEND_ACC_PPP_MASK ^ ZEND_ACC_PUBLIC)) || (fn_flags & ZEND_ACC_STATIC) == 0) { - zend_error(E_COMPILE_ERROR, "The magic method __callStatic() must have public visibility and be static"); + zend_error(E_WARNING, "The magic method __callStatic() must have public visibility and be static"); } CG(active_class_entry)->__callstatic = (zend_function *) CG(active_op_array); } else if ((name_len == sizeof(ZEND_GET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __get() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __get() must have public visibility and can not be static"); } CG(active_class_entry)->__get = (zend_function *) CG(active_op_array); } else if ((name_len == sizeof(ZEND_SET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __set() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __set() must have public visibility and can not be static"); } CG(active_class_entry)->__set = (zend_function *) CG(active_op_array); } else if ((name_len == sizeof(ZEND_UNSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __unset() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __unset() must have public visibility and can not be static"); } CG(active_class_entry)->__unset = (zend_function *) CG(active_op_array); } else if ((name_len == sizeof(ZEND_ISSET_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __isset() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __isset() must have public visibility and can not be static"); } CG(active_class_entry)->__isset = (zend_function *) CG(active_op_array); } else if ((name_len == sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && (!memcmp(lcname, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1))) { if (fn_flags & ((ZEND_ACC_PPP_MASK | ZEND_ACC_STATIC) ^ ZEND_ACC_PUBLIC)) { - zend_error(E_COMPILE_ERROR, "The magic method __toString() must have public visibility and can not be static"); + zend_error(E_WARNING, "The magic method __toString() must have public visibility and can not be static"); } CG(active_class_entry)->__tostring = (zend_function *) CG(active_op_array); } else if (!(fn_flags & ZEND_ACC_STATIC)) {