FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Operator precedence
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Object constructors/destructors [message #185140 is a reply to message #185121] Sat, 01 March 2014 17:56 Go to previous messageGo to previous message
Richard Damon is currently offline  Richard Damon
Messages: 58
Registered: August 2011
Karma:
Member
On 2/27/14, 8:25 AM, Jerry Stuckle wrote:
> On 2/26/2014 11:49 PM, Richard Damon wrote:
>> On 2/26/14, 8:44 AM, Jerry Stuckle wrote:
>>> On 2/26/2014 7:50 AM, Richard Damon wrote:
>>>>
>>>> An the "name" of the Deserializing constructor in PHP is __wakeup().
>>>>
>>>> You also do NOT get two destructor calls on the same object, the
>>>> deserializing created a new object.
>>>>
>>>
>>> __wakeup() is not a constructor - and does not do the same thing.
>>>
>>
>> What makes it NOT a constructor? IT seems to be exactly the thing that
>> does what you say must be done to make the new object via
>> unserialization.
>>
>
> If you want to consider __wakeup() to be a constructor, then you must
> consider __sleep() to be a destructor. In that case, PHP is also wrong
> because if an object is serialized, it will call both __sleep() and the
> destructor. This would be two calls to destructors for the same object.
>

WHY does __sleep() need to be a destructor?

__sleep() is a function to control how an object is serialized, and the
object, as you seem to know, still exists, so no destructor should
happen at this point, in fact, if you look at it, __sleep() has not
expected to have any effect on the current object, its purpose is to
make sure that __wakeup() will get all the data it needs, and allow the
removal of data that it won't need.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Correlating curl resources to some other object.
Next Topic: Experienced Web designer required
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 03:05:46 GMT 2024

Total time taken to generate the page: 0.04687 seconds