Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Lupus Michaelis
Ashley Sheridan wrote: That would seem sensible to me though really. A constructor only bears true for the base class, so any classes which inherit it must incorporate all the constructor parts. A destructor doesn't know about further classes which will need to inherit it, so it shouldn't be inh

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread hack988 hack988
i test your codes again,it is work correctly! But for backends compatibly with older php versions my codes is better :),i'm sorry for my mistake at moment. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
Stuart, u are right, the refcount in php 5 doesn't matter, where something left behind in my memory from earlier days, However i do have the effect that unsetting an object does NOT call __dectruct() ! but when the script ends it is called. this can be easily tested by putting a echo in destruct.

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
I dont agree, and as u see in my snipped code it works fine. in an abstract class u can define an implementation to define some basic things a overwriting function in an extending class has to take care of as well. this includes specialy magic functions. thats what they are made for. may be you

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread hack988 hack988
see http://cn.php.net/manual/en/language.oop5.abstract.php PHP 5 introduces abstract classes and methods. It is not allowed to create an instance of a class that has been defined as abstract. Any class that contains at least one abstract method must also be abstract. Methods defined as abstract sim

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Stuart
2009/8/24 Ralph Deffke : > this is also not the full truth try this and it works > what are the circumstances that is causing this problem then, yes I do have > distributed references over my script and there are clearly references still > set, however after running the snipped script I can not see

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
this is also not the full truth try this and it works what are the circumstances that is causing this problem then, yes I do have distributed references over my script and there are clearly references still set, however after running the snipped script I can not see what I do special in my script c

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Luke
2009/8/24 Ralph Deffke > typing error sorry > > forget my last post > > is there a was to destroy an object if there is hold a reference somewhere? > > "Stuart" wrote in message > news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... > > 2009/8/24 kranthi : > > > unset($obj) always

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
typing error sorry forget my last post is there a was to destroy an object if there is hold a reference somewhere? "Stuart" wrote in message news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com... > 2009/8/24 kranthi : > > unset($obj) always calls the __destruct() function of the cl

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ashley Sheridan
On Mon, 2009-08-24 at 15:13 +0200, Ralph Deffke wrote: > that is correct and that is the problem, and even that is not all !!! > > try this > > > abstract class a { > public function __construct(){ > echo "constructing"; > } > public function __detruct(){ > echo "destructing..

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Ralph Deffke
that is correct and that is the problem, and even that is not all !!! try this "; } public function __detruct(){ echo "destructing"; } } class b extends a{ } $c = new b(); unset( $c ); ?> the constructor is inherited, the destructor not !! PHP 5.2.9-1 and PHP 5.3.0 behave the sam

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Lupus Michaelis
kranthi wrote: unset($obj) always calls the __destruct() function of the class. Never calls the dtor. The dtor will be called only when the reference count reaches 0. class c { function __destruct() { echo 'dying !' ; } } $v1 = new c ; $v2 = $v1 ; unset($v1) ; // don't call the dtor unset

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread Stuart
2009/8/24 kranthi : > unset($obj) always calls the __destruct() function of the class. > > in your case clearly you are missing something else. Probably > unset($anobject) is not being called at all ? That's not entirely correct. PHP uses reference counting, so if unsetting a variable did not caus

Re: [PHP] unset( $anobject) does not invoce __destruct()

2009-08-24 Thread kranthi
unset($obj) always calls the __destruct() function of the class. in your case clearly you are missing something else. Probably unset($anobject) is not being called at all ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php