Bug with passing objects by reference and assigning a defeault null?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux