[PHP-CVS] cvs: php-src(PHP_5_3) /tests/classes __call_005.phpt __call_007.phpt ZendEngine2 zend_compile.c zend_vm_def.h zend_vm_execute.h ZendEngine2/tests call_static_006.phpt magic_methods_002.php
mattwil Sun Jun 7 15:46:58 2009 UTC Modified files: (Branch: PHP_5_3) /ZendEngine2zend_compile.c zend_vm_def.h zend_vm_execute.h /ZendEngine2/tests call_static_006.phpt magic_methods_002.phpt magic_methods_003.phpt magic_methods_004.phpt magic_methods_005.phpt magic_methods_007.phpt magic_methods_008.phpt magic_methods_010.phpt /php-src/tests/classes __call_005.phpt __call_007.phpt Log: MFH: Changed error messages to use "cannot" instead of "can not" (meaning "also can") http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.108&r2=1.647.2.27.2.41.2.109&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.108 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.109 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.108Thu Jun 4 18:20:42 2009 +++ ZendEngine2/zend_compile.c Sun Jun 7 15:46:51 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.108 2009/06/04 18:20:42 mattwil Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.109 2009/06/07 15:46:51 mattwil Exp $ */ #include #include "zend.h" @@ -1211,7 +1211,7 @@ 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_WARNING, "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 cannot 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) { @@ -1219,23 +1219,23 @@ } } 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_WARNING, "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 cannot 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_WARNING, "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 cannot 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_WARNING, "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 cannot 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_WARNING, "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 cannot 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)) { -
[PHP-CVS] cvs: php-src(PHP_5_3) /tests/classes __call_005.phpt
dmitry Wed Jun 11 06:30:09 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/tests/classes __call_005.phpt Log: Fixed test http://cvs.php.net/viewvc.cgi/php-src/tests/classes/__call_005.phpt?r1=1.1.4.3&r2=1.1.4.4&diff_format=u Index: php-src/tests/classes/__call_005.phpt diff -u php-src/tests/classes/__call_005.phpt:1.1.4.3 php-src/tests/classes/__call_005.phpt:1.1.4.4 --- php-src/tests/classes/__call_005.phpt:1.1.4.3 Tue Jun 3 14:07:15 2008 +++ php-src/tests/classes/__call_005.phpt Wed Jun 11 06:30:09 2008 @@ -22,4 +22,16 @@ $b->test(); ?> --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__call_005.php on line 3 +In A::__call(test1, array(1,a)) +object(B)#1 (0) { +} +In A::__call(test2, array(1,a)) +object(B)#1 (0) { +} +In A::__call(test3, array(1,a)) +object(B)#1 (0) { +} +In A::__call(test4, array(1,a)) +object(B)#1 (0) { +} -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /tests/classes __call_005.phpt ZendEngine2 zend_compile.c ZendEngine2/tests magic_methods_001.phpt magic_methods_002.phpt magic_methods_003.phpt magic_methods_004.p
Hi Dmitry, 2008/6/10, Dmitry Stogov <[EMAIL PROTECTED]>: > Hi Felipe, > > This patch breaks some existent code that worked fine before 5.3 (for > example ZendFramework). > > I understood the inconsistency, but I would prefer to change E_ERROR into > E_WARNING, so the code which worked with 5.2 will continue work with 5.3. Ok. Done! > Thanks. Dmitry. > > > Felipe Pena wrote: > > > felipe Tue Jun 3 14:07:15 2008 UTC > > > > Added files: (Branch: PHP_5_3) > >/ZendEngine2/tests magic_methods_001.phpt magic_methods_002.phpt > magic_methods_003.phpt magic_methods_004.phpt > magic_methods_005.phpt magic_methods_006.phpt > magic_methods_007.phpt magic_methods_008.phpt > magic_methods_009.phpt magic_methods_010.phpt > > Modified files: /ZendEngine2zend_compile.c > /php-src/tests/classes __call_005.phpt Log: > > - MFH: Fixed bug #44769 (declaring private magic methods should throw > error) > > > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Regards, Felipe Pena. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /tests/classes __call_005.phpt ZendEngine2 zend_compile.c ZendEngine2/tests magic_methods_001.phpt magic_methods_002.phpt magic_methods_003.phpt magic_methods_004
I think Framework is wrong here. Magic access handlers should be public, otherwise it's unclear what's supposed to happen when you access something and access handler is not visible. __ctor, __clone is ok now, not sure about __toString - generally allowing protecting __toString and throwing error if not accessible might be ok, though I don't see real use case for it... Dmitry Stogov wrote: Hi Felipe, This patch breaks some existent code that worked fine before 5.3 (for example ZendFramework). -- Stanislav Malyshev, Zend Software Architect [EMAIL PROTECTED] http://www.zend.com/ (408)253-8829 MSN: [EMAIL PROTECTED] -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /tests/classes __call_005.phpt ZendEngine2 zend_compile.c ZendEngine2/tests magic_methods_001.phpt magic_methods_002.phpt magic_methods_003.phpt magic_methods_004
Hi Felipe, This patch breaks some existent code that worked fine before 5.3 (for example ZendFramework). I understood the inconsistency, but I would prefer to change E_ERROR into E_WARNING, so the code which worked with 5.2 will continue work with 5.3. Thanks. Dmitry. Felipe Pena wrote: felipe Tue Jun 3 14:07:15 2008 UTC Added files: (Branch: PHP_5_3) /ZendEngine2/tests magic_methods_001.phpt magic_methods_002.phpt magic_methods_003.phpt magic_methods_004.phpt magic_methods_005.phpt magic_methods_006.phpt magic_methods_007.phpt magic_methods_008.phpt magic_methods_009.phpt magic_methods_010.phpt Modified files: /ZendEngine2 zend_compile.c /php-src/tests/classes __call_005.phpt Log: - MFH: Fixed bug #44769 (declaring private magic methods should throw error) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /tests/classes __call_005.phpt ZendEngine2 zend_compile.c ZendEngine2/tests magic_methods_001.phpt magic_methods_002.phpt magic_methods_003.phpt magic_methods_004.php
felipe Tue Jun 3 14:07:15 2008 UTC Added files: (Branch: PHP_5_3) /ZendEngine2/tests magic_methods_001.phpt magic_methods_002.phpt magic_methods_003.phpt magic_methods_004.phpt magic_methods_005.phpt magic_methods_006.phpt magic_methods_007.phpt magic_methods_008.phpt magic_methods_009.phpt magic_methods_010.phpt Modified files: /ZendEngine2zend_compile.c /php-src/tests/classes __call_005.phpt Log: - MFH: Fixed bug #44769 (declaring private magic methods should throw error) http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_compile.c?r1=1.647.2.27.2.41.2.64&r2=1.647.2.27.2.41.2.65&diff_format=u Index: ZendEngine2/zend_compile.c diff -u ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.64 ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.65 --- ZendEngine2/zend_compile.c:1.647.2.27.2.41.2.64 Mon May 12 09:09:05 2008 +++ ZendEngine2/zend_compile.c Tue Jun 3 14:07:15 2008 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.64 2008/05/12 09:09:05 dmitry Exp $ */ +/* $Id: zend_compile.c,v 1.647.2.27.2.41.2.65 2008/06/03 14:07:15 felipe Exp $ */ #include #include "zend.h" @@ -1203,7 +1203,37 @@ fn_flags |= ZEND_ACC_PUBLIC; } - if (!(CG(active_class_entry)->ce_flags & ZEND_ACC_INTERFACE)) { + 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"); + } + } 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"); + } + } 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"); + } + } 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"); + } + } 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"); + } + } 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"); + } + } 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"); + } + } + } else { char *short_class_name; int short_class_name_length; char *short_class_lcname; @@