Re: strange mysqli error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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();

> 
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux