cvs: ZendEngine2 / zend_API.c /tests magic_by_ref_001.phpt magic_by_ref_002.phpt magic_by_ref_003.phpt magic_by_ref_004.phpt magic_by_ref_005.phpt
magic_by_ref_006.phpt magic_by_ref_007.phpt magic_by_ref_008.phpt magic_by_ref_009.phpt magic_by_ref_010.phpt
| From: | Antony Dovgal | Date: | Fri, 31 Aug 2007 12:36:01 +0000 |
| Subject: | cvs: ZendEngine2 / zend_API.c /tests magic_by_ref_001.phpt magic_by_ref_002.phpt magic_by_ref_003.phpt magic_by_ref_004.phpt magic_by_ref_005.phpt magic_by_ref_006.phpt magic_by_ref_007.phpt magic_by_ref_008.phpt magic_by_ref_009.phpt magic_by_ref_010.phpt |
||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-5983@lists.php.net to get a copy of this message | ||
tony2001 Fri Aug 31 12:36:01 2007 UTC
Added files:
/ZendEngine2/tests magic_by_ref_001.phpt magic_by_ref_002.phpt
magic_by_ref_003.phpt magic_by_ref_004.phpt
magic_by_ref_005.phpt magic_by_ref_006.phpt
magic_by_ref_007.phpt magic_by_ref_008.phpt
magic_by_ref_009.phpt magic_by_ref_010.phpt
Modified files:
/ZendEngine2 zend_API.c
Log:
prohibit arguments by ref in magic methods
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.442&r2=1.443&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.442 ZendEngine2/zend_API.c:1.443 --- ZendEngine2/zend_API.c:1.442 Mon Aug 20 09:48:41 2007 +++ ZendEngine2/zend_API.c Fri Aug 31 12:36:00 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.442 2007/08/20 09:48:41 dmitry Exp $ */ +/* $Id: zend_API.c,v 1.443 2007/08/31 12:36:00 tony2001 Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2012,23 +2012,47 @@ ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1) && fptr->common.num_args != 0) { zend_error(error_type, "Method %v::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME); } else if (lcname_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_GET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_SET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_UNSET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_ISSET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1)) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_CALL_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1)) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_TOSTRING_FUNC_NAME) - 1 && ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0) { zend_error(error_type, "Method %v::%s() cannot take arguments", ce->name, ZEND_TOSTRING_FUNC_NAME); http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_001.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_001.phpt +++ ZendEngine2/tests/magic_by_ref_001.phpt --TEST-- passing first parameter of __set() by ref --FILE-- <?php class test { function __set(&$name, $val) { } } $t = new test; $name = "prop"; $t->$name = 1; echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_002.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_002.phpt +++ ZendEngine2/tests/magic_by_ref_002.phpt --TEST-- passing second parameter of __set() by ref --FILE-- <?php class test { function __set($name, &$val) { } } $t = new test; $t->prop = 1; echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_003.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_003.phpt +++ ZendEngine2/tests/magic_by_ref_003.phpt --TEST-- passing parameter of __get() by ref --FILE-- <?php class test { function __get(&$name) { } } $t = new test; $name = "prop"; var_dump($t->$name); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__get() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_004.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_004.phpt +++ ZendEngine2/tests/magic_by_ref_004.phpt --TEST-- passing parameter of __unset() by ref --FILE-- <?php class test { function __unset(&$name) { } } $t = new test; $name = "prop"; var_dump($t->$name); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__unset() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_005.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_005.phpt +++ ZendEngine2/tests/magic_by_ref_005.phpt --TEST-- passing parameter of __isset() by ref --FILE-- <?php class test { function __isset(&$name) { } } $t = new test; $name = "prop"; var_dump(isset($t->$name)); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__isset() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_006.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_006.phpt +++ ZendEngine2/tests/magic_by_ref_006.phpt --TEST-- passing first parameter of __call() by ref --FILE-- <?php class test { function __call(&$name, $args) { } } $t = new test; $func = "foo"; $t->$func(); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_007.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_007.phpt +++ ZendEngine2/tests/magic_by_ref_007.phpt --TEST-- passing second parameter of __call() by ref --FILE-- <?php class test { function __call($name, &$args) { } } $t = new test; $func = "foo"; $arg = 1; $t->$func($arg); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_008.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_008.phpt +++ ZendEngine2/tests/magic_by_ref_008.phpt --TEST-- passing first parameter of __callstatic() by ref --FILE-- <?php class test { function __callstatic(&$name, $args) { } } $t = new test; $func = "foo"; $t->$func(); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__callstatic() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_009.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_009.phpt +++ ZendEngine2/tests/magic_by_ref_009.phpt --TEST-- passing second parameter of __callstatic() by ref --FILE-- <?php class test { function __callstatic($name, &$args) { } } $t = new test; $func = "foo"; $arg = 1; $t->$func($arg); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__callstatic() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_010.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_010.phpt +++ ZendEngine2/tests/magic_by_ref_010.phpt --TEST-- passing arguments by ref to a method handled by __call() --FILE-- <?php class Foo { function __call($method, $args) { print $args[0]."\n"; $args[0] = 5; print $args[0]."\n"; return true; } } $v = 'str'; $o = new Foo(); $o->test(&$v); var_dump($v); echo "Done\n"; ?> --EXPECTF-- Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d str 5 int(5) Done
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.442&r2=1.443&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.442 ZendEngine2/zend_API.c:1.443 --- ZendEngine2/zend_API.c:1.442 Mon Aug 20 09:48:41 2007 +++ ZendEngine2/zend_API.c Fri Aug 31 12:36:00 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.442 2007/08/20 09:48:41 dmitry Exp $ */ +/* $Id: zend_API.c,v 1.443 2007/08/31 12:36:00 tony2001 Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -2012,23 +2012,47 @@ ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CLONE_FUNC_NAME, sizeof(ZEND_CLONE_FUNC_NAME)-1) && fptr->common.num_args != 0) { zend_error(error_type, "Method %v::%s() cannot accept any arguments", ce->name, ZEND_CLONE_FUNC_NAME); } else if (lcname_len == sizeof(ZEND_GET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_GET_FUNC_NAME, sizeof(ZEND_GET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_GET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_GET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_SET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_SET_FUNC_NAME, sizeof(ZEND_SET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_SET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_SET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_UNSET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_UNSET_FUNC_NAME, sizeof(ZEND_UNSET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_UNSET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_UNSET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_ISSET_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1) && fptr->common.num_args != 1) { - zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_ISSET_FUNC_NAME, sizeof(ZEND_ISSET_FUNC_NAME)-1)) { + if (fptr->common.num_args != 1) { + zend_error(error_type, "Method %v::%s() must take exactly 1 argument", ce->name, ZEND_ISSET_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_ISSET_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_CALL_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)-1)) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALL_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_CALL_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_CALLSTATIC_FUNC_NAME) - 1 && - ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1) && fptr->common.num_args != 2) { - zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_CALLSTATIC_FUNC_NAME, sizeof(ZEND_CALLSTATIC_FUNC_NAME)-1)) { + if (fptr->common.num_args != 2) { + zend_error(error_type, "Method %v::%s() must take exactly 2 arguments", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + } else if (ARG_SHOULD_BE_SENT_BY_REF(fptr, 1) || ARG_SHOULD_BE_SENT_BY_REF(fptr, 2)) { + zend_error(error_type, "Method %v::%s() cannot take arguments by reference", ce->name, ZEND_CALLSTATIC_FUNC_NAME); + } } else if (lcname_len == sizeof(ZEND_TOSTRING_FUNC_NAME) - 1 && ZEND_U_EQUAL(utype, lcname, lcname_len, ZEND_TOSTRING_FUNC_NAME, sizeof(ZEND_TOSTRING_FUNC_NAME)-1) && fptr->common.num_args != 0) { zend_error(error_type, "Method %v::%s() cannot take arguments", ce->name, ZEND_TOSTRING_FUNC_NAME); http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_001.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_001.phpt +++ ZendEngine2/tests/magic_by_ref_001.phpt --TEST-- passing first parameter of __set() by ref --FILE-- <?php class test { function __set(&$name, $val) { } } $t = new test; $name = "prop"; $t->$name = 1; echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_002.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_002.phpt +++ ZendEngine2/tests/magic_by_ref_002.phpt --TEST-- passing second parameter of __set() by ref --FILE-- <?php class test { function __set($name, &$val) { } } $t = new test; $t->prop = 1; echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_003.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_003.phpt +++ ZendEngine2/tests/magic_by_ref_003.phpt --TEST-- passing parameter of __get() by ref --FILE-- <?php class test { function __get(&$name) { } } $t = new test; $name = "prop"; var_dump($t->$name); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__get() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_004.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_004.phpt +++ ZendEngine2/tests/magic_by_ref_004.phpt --TEST-- passing parameter of __unset() by ref --FILE-- <?php class test { function __unset(&$name) { } } $t = new test; $name = "prop"; var_dump($t->$name); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__unset() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_005.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_005.phpt +++ ZendEngine2/tests/magic_by_ref_005.phpt --TEST-- passing parameter of __isset() by ref --FILE-- <?php class test { function __isset(&$name) { } } $t = new test; $name = "prop"; var_dump(isset($t->$name)); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__isset() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_006.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_006.phpt +++ ZendEngine2/tests/magic_by_ref_006.phpt --TEST-- passing first parameter of __call() by ref --FILE-- <?php class test { function __call(&$name, $args) { } } $t = new test; $func = "foo"; $t->$func(); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_007.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_007.phpt +++ ZendEngine2/tests/magic_by_ref_007.phpt --TEST-- passing second parameter of __call() by ref --FILE-- <?php class test { function __call($name, &$args) { } } $t = new test; $func = "foo"; $arg = 1; $t->$func($arg); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__call() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_008.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_008.phpt +++ ZendEngine2/tests/magic_by_ref_008.phpt --TEST-- passing first parameter of __callstatic() by ref --FILE-- <?php class test { function __callstatic(&$name, $args) { } } $t = new test; $func = "foo"; $t->$func(); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__callstatic() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_009.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_009.phpt +++ ZendEngine2/tests/magic_by_ref_009.phpt --TEST-- passing second parameter of __callstatic() by ref --FILE-- <?php class test { function __callstatic($name, &$args) { } } $t = new test; $func = "foo"; $arg = 1; $t->$func($arg); echo "Done\n"; ?> --EXPECTF-- Fatal error: Method test::__callstatic() cannot take arguments by reference in %s on line %d http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/magic_by_ref_010.phpt?view=markup&rev=1.1 Index: ZendEngine2/tests/magic_by_ref_010.phpt +++ ZendEngine2/tests/magic_by_ref_010.phpt --TEST-- passing arguments by ref to a method handled by __call() --FILE-- <?php class Foo { function __call($method, $args) { print $args[0]."\n"; $args[0] = 5; print $args[0]."\n"; return true; } } $v = 'str'; $o = new Foo(); $o->test(&$v); var_dump($v); echo "Done\n"; ?> --EXPECTF-- Strict Standards: Call-time pass-by-reference has been deprecated in %s on line %d str 5 int(5) Done