Re: [PHP] Re: Question about __destruct()



On 22 Oct 2008, at 14:42, Dan Joseph wrote:
On Tue, Oct 21, 2008 at 5:14 PM, Stut <stuttle@xxxxxxxxx> wrote:
When a script ends everything is released (with some small exceptions),
thus also all references to instances of classes.
Thus AFAIK a deconstructor will always be called at the end of script
execution.

but you have no control over what order dtors are called and you can't
make
any assumptions about state of file handles to STDIN/STDOUT and things
like
that ... personally I find dtors run at end of script to be nigh on
useless.

I use destructors to update dirty objects in memcache. I also use them in
my template class to optionally automagically output the footer without
needing an explicit call on each page.

Never any issues this way? They always run without a hitch?

Not had any issues to far, and it's being used on some pretty busy sites and various PHP versions and several different web servers.

-Stut

--
http://stut.net/
.



Relevant Pages

  • Re: temp files for security/logcheck
    ... AFAIK, the files disappear each time the script is run: ... may be an attempt to spoof the log checker." ...
    (FreeBSD-Security)
  • Re: Database Projects - sql code
    ... but AFAIK you can't use the full set of Visual Database tools such ... as generating create script with MSDE, ...
    (microsoft.public.vsnet.general)
  • Re: Object doesnt support this property or method
    ... It's an error in the script for that web page. ... web page you can't do anything to solve it, AFAIK. ... > doesn't support this property or method" and gives a line number. ... > It's driving me mad, ...
    (microsoft.public.windowsxp.newusers)
  • Re: Command help?
    ... really need to run /etc/rc.d/rc with the desired runlevel to force the ... AFAIK the change in run level causes the ... script to be run automatically. ...
    (Fedora)
  • Re: always the same object
    ... > a tuple with always the same id, which is AFAIK the memory location of ... suppose you are using the same list multiple times later in your script, ... observed behaviour along with a short description of what the script is ...
    (comp.lang.python)