AW: [PHP-DEV] return /* by reference */ new Foo() in PHP4

From: Date: Sun, 09 Oct 2005 14:36:00 +0000
Subject: AW: [PHP-DEV] return /* by reference */ new Foo() in PHP4
Groups: php.internals 
Request: Send a blank email to internals+get-19539@lists.php.net to get a copy of this message
Hm, thinking a little more about this one: > > function &getstuff($in) > > { > > if ($in=='ok') > > return new MyObject(); > > else > > return false; // this is the common line > > } "return false" (or null) is trying to return a reference to a literal, which is (of course) questionable. "new fooclass()" is *not* a literal but something that *can* and *should* be referenced: see http://www.php.net/manual/en/language.references.whatdo.php. So at least "return /* byref*/ new ..." should be something that works without a notice. Matthias

« previous php.internals (#19539) next »