Hi,

It seems SplObjectStorage will solve my issue.
We already spoke on pvt about how to handle things correctly too.

Although this solve my issue, the point that Stan highlighted is
valid. You may not find a good place where to use it, but
spl_object_hash is there and it has drawbacks. Just naming collision
possibility is enough to convince me about function change, even
though I can't imagine a usage of it now.

If none can find a usage, so we can drop spl_object_hash, right? If
you don't agree, then we need some change to make it faster and
non-collision proof.


Regards,

On Tue, Jan 20, 2009 at 10:26 AM, Etienne Kneuss <webmas...@colder.ch> wrote:
> Hello,
>
> On Tue, Jan 20, 2009 at 11:47 AM, Stan Vassilev | FM
> <sv_for...@fmethod.com> wrote:
>>
>> Hi,
>>
>> I had a talk with Marcus, and he has agreed on this proposed solution:
>>
>> 1) SPL generates a pseudo-random session id/mask (for the current request,
>> do not confuse with $_SESSION), which consists of 32 random
>> bytes/characters.
>> 2) The object is and the handler pointer are used to create a unique
>> identifier for the object, by padding each pointer to 16 bytes and joining
>> them together.
>> 3) The resulting byte sequence is XOR-red with the session mask so the
>> object id/handler are not retrievable in userland, and the resulting
>> sequence/string is returned.
>>
>> This is better than spl_object_hash for two reasons:
>>
>> 1) no printf of numbers, no expensive md5 hashing, no hex conversion.
>> 2) no possible collisions
>>
>> Drawbacks:
>>
>> 1) might generate some non-printable chars after xor (but this wouldn't
>> matter for operation). The idea above can be tweaked to solve this.
>>
>> The "32-bit string" format is to preserve compatibility with
>> spl_object_hash, so it can replace it, instead of introducing a new similar
>> function.
>>
>> I've had no time to look further into this, but Marcus seems to like the
>> basic idea, so feel welcome...
>
> Could you please provide an example, with code, in which this function
> would be necessary ? (i.e. where you can't use SplObjeccctStorage)
>
> Thanks.
>
>>
>> Regards,
>> Stan Vassilev
>>
>> --
>> PHP Internals - PHP Runtime Development Mailing List
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>>
>
>
>
> --
> Etienne Kneuss
> http://www.colder.ch
>
> Men never do evil so completely and cheerfully as
> when they do it from a religious conviction.
> -- Pascal
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



-- 
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9215-8480
MSN: guilhermebla...@hotmail.com
URL: http://blog.bisna.com
São Paulo - SP/Brazil

Reply via email to