Bug with passing objects by reference and assigning a defeault null?
| From: | Shu Chow | Date: | Fri, 06 Apr 2007 16:19:57 +0000 |
| Subject: | Bug with passing objects by reference and assigning a defeault null? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-252172@lists.php.net to get a copy of this message | ||
Has anyone tried to assign a default value of null for an object passed by reference in PHP4?
Let's say I had this code:
$mObj = new testModel();
$mObj->msg = "Bubba";
testFunc();
class testModel {
var $msg;} function testFunc(&$msg=null) {
echo $msg->msg;} Under PHP5, this works fine. Under PHP4, the "=" will cause an error: Parse error: syntax error, unexpected '=', expecting ')'. Removing the "&" in the parameter definition makes it work. I'm using 4.4.2 right now, but don't see anything in the later change logs that say this was fixed. I also don't find any mention of it in the bugs list. Is this a legit bug or am I committing a big no-no?