Re: strange mysqli error
| From: | Jochem Maas | Date: | Wed, 23 Aug 2006 17:41:30 +0000 |
| Subject: | Re: strange mysqli error | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-241054@lists.php.net to get a copy of this message | ||
Richard K Miller wrote:
>
> On Aug 23, 2006, at 2:33 AM, Jochem Maas wrote:
>
>> how do you know which object is destroyed first?
>>
>> also you are using 3 different versions of php - not something that will
>> help narrow down the problem.
>>
...
>>
>
> No errors when I use unset(). I see what you mean about not knowing
> which object is destroyed first. Maybe I'll have to use a non-OOP
> connection to MySQL,
you can still use OOP, only you can't rely on auto destruct with
regard to object existance.
> since it wouldn't appear there's any way to specify
> the order of destruction of objects.
try the ini settings auto_prepend_file auto_append_file
http://php.net/manual/en/ini.core.php#ini.auto-append-file
and use them to control the startup &/or shutdown phase of your app. e.g:
class DB {
private $connObj; // obj of class DB
// don't allow references to it outside the class
static function shutdown() { unset(self::$connObj); /* trigger self::__destruct() */ }
function __destruct() { /* do stuff (which you could just as well do in self::shutdown()?) */ }
}
shutdown.php:
<?php
DB::shutdown();
>
>