On 7/30/07, Marcus Boerger <[EMAIL PROTECTED]> wrote:
> Hello Pavel,
>
>   I still fail to understand why spl_object_hash() does not work for you.

Hello.

Just as a side note, this broke a few things for me. For example, in
an application, I have 2 arrays of objects, and I try to call
array_diff() on them.
Before PHP 5.2, it would work, possibly because array_diff() would
cast the objects as strings, and then compare them (if I understood
the problem correctly).
Now, this doesn't work anymore, because the object can't be cast to
string by default.
Of course, I could add a __toString() method to the objects and return
something there, but problem is, all objects are extended from a base
class from PEAR (it's DB_DataObject), and it wouldn't be a Good Thing
to modify the PEAR class directly (updates would break).
So, I got kind of stuck, and tried to add the __toString() dynamically
to the objects in question using the "runkit" PECL package, but
although it adds the method correctly, PHP doesn't recognize it as a
magic method, and won't call it when needed (filed bug #11691 on PECL
for it).
Do you think there's an easy and clean approaching to solve this kind
of problem? Or maybe the problem should be solved on array_diff() and
other functions to make them not try to cast the object as a string to
compare?

Thanks

--
Bruno Lustosa <[EMAIL PROTECTED]>
ZCE - Zend Certified Engineer - PHP!
http://www.lustosa.net/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to