Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm not on PHP 5.3 myself, but I think that attached patch is required.
Comment | File | Size | Author |
---|---|---|---|
#14 | entity_save.patch | 1.27 KB | fago |
entity.save_.0.patch | 947 bytes | sun | |
Comments
Comment #1
fagoI'm not on it either, but the reference is currently required for user saving to work. Once #999004: user_save() relies on $edit instead of $account is fixed, this problem would be gone though.
Is anyone on 5.3 experiencing troubles with that?
Also, why should the reference problematic? When entity_save() is called directly with an entity object, it should work, or?
Comment #2
pillarsdotnet CreditAttribution: pillarsdotnet commentedI'm running php 5.3 without this patch, with E_ALL turned on, and haven't seen any notices pointing to this particular issue.
Comment #3
pillarsdotnet CreditAttribution: pillarsdotnet commented@fago -- the reference is only problematic if this particular function gets called by call_user_func_array(). See the note in the PHP manual, just above the user-contributed section. It looks like none of your callback functions take a variable number of arguments, so they should be okay. Hook functions that are dispatched by module_invoke() or module_invoke_all() are a different story.
Comment #4
fagoyep, but entity_save() isn't called that way so it should be fine.
Comment #5
chx CreditAttribution: chx commentedThe patch is completely harmless, it's entirely pointless (and one might say wrong and misunderstood) to take an object by reference. http://drupal4hu.com/node/224
Comment #7
sunyeah, I think we did the same for all function arguments being objects throughout Drupal core.
Comment #8
pillarsdotnet CreditAttribution: pillarsdotnet commentedTitle change, since this has nothing to do with php 5.3 compatibility.
Comment #9
fagoIn that case, it's not true. As said, the current saving implementing for users changes the reference on the object. PHP5's way of dealing with objects is not the same as a reference, so don't mix that up.
And without the user_save() patch being committed, this patch is not harmless. Try running entity API tests without it...
Comment #10
fagoPostponed till #999004: user_save() relies on $edit instead of $account is fixed.
Comment #11
pillarsdotnet CreditAttribution: pillarsdotnet commentedSince #999004: user_save() relies on $edit instead of $account is fixed, this should no longer be postponed.
Comment #12
pillarsdotnet CreditAttribution: pillarsdotnet commentedentity.save_.0.patch queued for re-testing.
Comment #13
fagoright. I've updated the patch so the user-callback doesn't try to change the entity object any more.
I guess we should introduce a dependency on 7.2 once we commit the patch. Though #1013302: Versioned dependencies fail with dev versions and git clones still bothers me.
Comment #14
fagoComment #15
fagocommitted - be sure to run drupal > 7.2 when using entity_save() for user accounts.
I'm adding a note that we require 7.2 on the project page.