[PATCH] disallow arguments by ref in magic methods
| From: | Antony Dovgal | Date: | Thu, 30 Aug 2007 12:55:59 +0000 |
| Subject: | [PATCH] disallow arguments by ref in magic methods | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-31983@lists.php.net to get a copy of this message | ||
Hello.
I'd like to commit these two patches (for HEAD and 5_2 appropriately).
The patches disallow declaring any magic methods as accepting arguments by ref (which makes no sense
anyway).
Example:
<?php
class test {
function __set(&$name, $val) { }
}
$t = new test;
$name = "prop";
$t->$name = 1;
?>
Expected result of this code is:
Fatal error: Method test::__set() cannot take arguments by reference in %s on line %d
The diffs:
http://dev.daylessday.org/diff/magic_by_ref_5_2.diff
http://dev.daylessday.org/diff/magic_by_ref_HEAD.diff
If there are no objections, I'm going to commit them later in the evening.
--
Wbr,
Antony Dovgal