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.

CommentFileSizeAuthor
#2 use_builtin_equality.patch1.91 KBjazzslider

Comments

jazzslider’s picture

Hello!

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

jazzslider’s picture

StatusFileSize
new1.91 KB

Hello!

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

jazzslider’s picture

Status: Active » Needs review

Bah…I cannot seem to remember to change statuses…

dmitrig01’s picture

I'm fine dropping php 4 support.

jazzslider’s picture

Status: Needs review » Fixed

Patch committed; exportables_compare_object() is now deprecated in favor of the builtin == operator, which appears to have the same behavior.

Thanks!
Adam

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.