note 24514 deleted from function.register-shutdown-function by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 17:00:58 +0000 |
| Subject: | note 24514 deleted from function.register-shutdown-function by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217849@lists.php.net to get a copy of this message | ||
Note Submitter: adam at saki dot com dot au
----
When using objects the syntax register_shutdown_function(array($object, 'function')) will
take a copy of the object at the time of the call. This means you cannot do this in the constructor
and have it correctly destruct objects. The alternative is to use
register_shutdown_function(array(&$object, 'function')) where the ampersand passes the
reference and not the copy. This appears to work fine.