PHP 4.0 Bug #7598 Updated: modify "new" syntax
| From: | waldschrott@php.net | Date: | Thu, 02 Nov 2000 19:15:57 +0000 |
| Subject: | PHP 4.0 Bug #7598 Updated: modify "new" syntax | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-36817@lists.php.net to get a copy of this message | ||
ID: 7598
Updated by: waldschrott
Reported By: danjrod@terra.es
Status: Feedback
Bug Type: Feature/Change Request
Assigned To:
Comments:
how did you verify/find out that it is copied?
Previous Comments:
---------------------------------------------------------------------------
[2000-11-02 13:59:11] danjrod@terra.es
Assigning the value returned by "new xxxx()" to a variable creates a copy of the
constructed object.
"new" does not support returning references by default, or prepending an ampersand,
'&', to have a reference returned.
Thus the request is:
- Modify new syntax to either:
a) It always returns a reference. This is unlikely to
break any existing code. At most people will be
creating a reference to a reference, which won´t harm
b) Support the '&' syntax like in "&new xxx", so that
a reference can be asked for. This will not break
any existing code.
This only implies slightly modifying "zend-parser.y", and
no further changes to any part of the zend engine.
This change will cure the use of "$this" as a reference inside the object constructor,
which has been wrongly dismissed as a "circular reference problem".
Regards
Daniel
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=7598