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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

I'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

rfay’s picture

Status: Active » Postponed (maintainer needs more info)

Would love to help with this but haven't had a response.

rfay’s picture

This 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.

fp’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
781 bytes

From 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.

Status: Needs review » Needs work

The last submitted patch, role_change_notify.731344.patch, failed testing.

rfay’s picture

It 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.

fp’s picture

Status: Needs work » Needs review
FileSize
787 bytes

Silly me. Here's a patch against dev.

rfay’s picture

Version: 6.x-2.1 » 6.x-2.x-dev
FileSize
557 bytes

@fp, sorry so slow to respond.

Your patch

+++ role_change_notify.module	24 Mar 2010 05:49:57 -0000
@@ -348,7 +348,7 @@ function role_change_notify_token_values
-        if(strpos($key, 'profile_') === 0) {
+        if(strpos($key, 'profile_') === 0 && $user->key != '') {
           $tokens[$key] = check_plain($account->$key);

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.

fp’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Thank you.

rfay’s picture

Status: Reviewed & tested by the community » Fixed

Committed 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.

Status: Fixed » Closed (fixed)

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