Re: Allow (...)->foo() expressions not only for `new`
| From: | Stas Malyshev | Date: | Sun, 03 Mar 2013 10:26:30 +0000 |
| Subject: | Re: Allow (...)->foo() expressions not only for `new` | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-66442@lists.php.net to get a copy of this message | ||
Hi
>
> - usage expression in write context (e.g. passing constant by reference)
>
> function foo(&$foo) {}
> foo("abc"[0]);
>
> - destruction of temporary result
>
> ($a . $b)[4]; // if ($a.$b) is destroyed?
>
> - in some cases destruction of temporary result may cause destruction of
> final result
>
> ((object)(array("a"=>"b")))->a = "c"; // temporary object
> may be destroyed
> before assignment
I've run a bunch of examples like above, with debug enabled, and so far
I could find no scenario where it would leak or access destructed
variable. So looks like it works, at least I wasn't able to find any
case where it does not :)
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227