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 have installed/enabled the Role Change Notify module, and when I update a user's role, I get the following message upon save ->
warning: preg_match() expects parameter 2 to be string, array given in /var/........./includes/bootstrap.inc on line 777.
When I disable the module, the error no longer appears.
Comment | File | Size | Author |
---|---|---|---|
#8 | role_change_notify.profile_field_empty.patch | 557 bytes | rfay |
#7 | role_change_notify.731344-2.patch | 787 bytes | fp |
#4 | role_change_notify.731344.patch | 781 bytes | fp |
Comments
Comment #1
rfayI'm unable to recreate this behavior so I'll need you to give me more information.
You say "I just installed role_change_notify": Does that mean you installed it and then configured notifications for some roles? Which roles?
What technique are you using for updating the user's role? going to their /user page?
Have you configured any triggers or actions?
What other modules are installed, please. Especially, do you have token and trigger installed?
I always appreciate bug reports as they make the module better, but I just need some more info on this one.
Thanks,
-Randy
Comment #2
rfayWould love to help with this but haven't had a response.
Comment #3
rfayThis may have been improved by #736086: Cannot use object of type stdClass as array, Remove extra hook invocation, so if you're still interested in this, please test with the next dev version.
Comment #4
fp CreditAttribution: fp commentedFrom what I can gather this happens role_change_notify_token_values() when an empty profile value is sent to check_plain.
I haven't tried (or even looked at) the dev version mentioned in #3 but this patch fixes this issue.
Comment #6
rfayIt looks like the patch doesn't apply, but you've provided the magic answer. Thanks very much! If you want to reroll the patch against current dev, that's fantastic, but at least you've given the clue of how to recreate this. Thanks.
Comment #7
fp CreditAttribution: fp commentedSilly me. Here's a patch against dev.
Comment #8
rfay@fp, sorry so slow to respond.
Your patch
It's $account, not $user, and $account->$key, not $user->key. This construct will just prevent profile tokens from ever being used (and also remove the warnings you got)
Attached is what I think you meant. Could you try it and report back?
This problem does not exist in D7 role_change_notify, because the profile field tokens have been removed.
Powered by Dreditor.
Comment #9
fp CreditAttribution: fp commentedLooks good. Thank you.
Comment #10
rfayCommitted to HEAD: http://drupal.org/cvs?commit=366452
Thanks so much, fp, deejmer.
@deejmer, it would be great for you to test the dev release and see if this resolves your issue.