note 93221 deleted from function.register-shutdown-function by cmb

From: Date: Sun, 24 Nov 2019 09:00:08 +0000
Subject: note 93221 deleted from function.register-shutdown-function by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-213228@lists.php.net to get a copy of this message
Note Submitter: michaeln at associationsplus dawt see eh ---- This may seem obvious to many people, but don't register an object's __destruct() function as a shutdown function! In many instances, it will then call the destructor twice, most likely on an already destroyed object! For example, you might get this error: PHP Warning: mysqli::close() [<a href='function.mysqli-close'>function.mysqli-close</a>]: Couldn't fetch mysqli in /path/to/file.php I saw docey's comment from 2006 in this very page where they do just that, and this more often than not cause problems! It would be wise to look out for old code where someone has done that very thing then too!

« previous php.notes (#213228) next »