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

From: Date: Fri, 06 Apr 2007 17:14:36 +0000
Subject: Re: Bug with passing objects by reference and assigning a defeault null?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-252173@lists.php.net to get a copy of this message
On Fri, 2007-04-06 at 12:19 -0400, Shu Chow wrote: > 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? Not a bug, it's a limitation of PHP4. Cheers, Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#252173) next »