Bug #14539: Assigning null to reference has unexpected results.

From: Date: Sun, 16 Dec 2001 01:15:15 +0000
Subject: Bug #14539: Assigning null to reference has unexpected results.
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-3495@lists.php.net to get a copy of this message
From: jfrisby@mrjoy.com Operating system: All PHP version: 4.0.6 PHP Bug Type: PEAR related Bug description: Assigning null to reference has unexpected results. $foo =& new SomePEARDervidedClassWithADestructor(); $foo = null; In the above case, the destructor is never called. Presumably, the assignment is being interpreted as requesting that the object instance be nullified, rather than the more intuitive (IMNSHO) notion of nullifying the reference to the object. If you change the null-assignment line above to be: function &nullref() { return null; } $foo =& nullref(); The desired semantics are preserved. Of course, the following is presently invalid: $foo =& null; May I suggest that the above be added to allow the desired semantics in a simple fashion? Or at the very least, document this rather unexpected behavior? -- Edit bug report at: http://bugs.php.net/?id=14539&edit=1

« previous php.pear.dev (#3495) next »