Closed (fixed)
Project:
Exportables
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2009 at 05:22 UTC
Updated:
28 Nov 2009 at 22:50 UTC
Jump to comment: Most recent file
Hi,
I have doubts about function "exportables_compare_object()". If you just want to compare two objects, you could use "==" (http://php.net/manual/en/language.oop5.object-comparison.php). But thing is sometimes the loaded object can be altered by some other modules (it doesn't happen with taxonomy, but happens with node, user etc.). So I guess you need a function that can recognize the loaded object and the exported object, and check one against another.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | use_builtin_equality.patch | 1.91 KB | jazzslider |
Comments
Comment #1
jazzslider commentedHello!
Perhaps @dmitrig01 can speak to that; as it stands currently, exportables_compare_object() isn't really doing much more than the "==" operator would …and I believe I ran into one instance where it actually failed to get a correct comparison (didn't work for a nested array, I think) …but I was working on something else at the time, and haven't run into that problem since, so I could be remembering it wrong.
It may also have been written that way because of differences in how the equality operator works with objects in PHP 4 and PHP 5…again, I could be remembering that wrong too; it's been a long time since I did anything in PHP 4.
I'll be looking into this further over the next few days.
Thanks!
Adam
Comment #2
jazzslider commentedHello!
OK, I spent some time looking at PHP's documentation on object comparison in PHP 5 and in PHP 4, as well as running some of my own tests to make sure I was reading things right.
Turns out that the standard == behavior is functionally identical to what exportables_compare_object() was doing, just as @makara said. Accordingly, I've attached a patch that deprecates the function in favor of using ==; please review, and if I don't see any objections here in the next day or two I'll go ahead and commit it.
Thanks!
Adam
Comment #3
jazzslider commentedBah…I cannot seem to remember to change statuses…
Comment #4
dmitrig01 commentedI'm fine dropping php 4 support.
Comment #5
jazzslider commentedPatch committed; exportables_compare_object() is now deprecated in favor of the builtin == operator, which appears to have the same behavior.
Thanks!
Adam