You are here: Re: [PHP] Interesting problem in PHP and Squirrelmail « PHP « IT news, forums, messages
Re: [PHP] Interesting problem in PHP and Squirrelmail

Posted by Mark on 01/18/06 23:20

Robert Cummings wrote:

> On Wed, 2006-01-18 at 15:36, Mark wrote:
>>
>> [-- CLIPPED --]
>>
>> Here's a point of debate, should this sort of behavior be allowed? If it
>> is allowable, how does one support it in any sort of serialized
>> methodology? I have a few ideas but none very pretty. I'm pretty sure it
>> causes problems in regular PHP as these sorts of pages sometimes have
>> problems anyway.
>
> Yes it should be allowed, yes you can serialize it. Look at PHP's
> serializer. You'll notice they track recursive structures and properly
> unserialize them. One way to do it is to unroll objects into a single
> lookup. When you FIRST encounter an object assign it a unique ID (make
> it a property on the object that is unlikely to collide with any other),

This was that "but nove very pretty" options I was thinking about.

> add the object to the lookup with the UID as the key and continue
> serializing, the next time you encounter the object, you know you're
> recursing and so in your serializer you have a special marker that
> indicates the current object points to an existing serialized object
> with the given UID. Then you move onto the next item. Your unserializer
> will then be able to traverse the serialized data and as it comes across
> objects it can create the same lookup and when it hits the recurse
> marker it will know to create a reference to the original.
>
> The implementation is slightly more difficult than what I've just
> described, but simple enough :)

It's truly ugly, don't you think?

>
> HTH,
> Rob.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация