Received the following error when trying to view user profiles (with statuses enabled, that show view statuses_stream, with mention -dev version, processing through a plain text filter):

PHP Fatal error: [] operator not supported for strings
*coming from*
l() /path/to/my/site/sites/all/modules/mentions/mentions.module:543

After some debugging, and based on this clue I added an array() wrapper to the class attribute in the l() function, like so:

  return l($settings['output']['prefix'] . $text . $settings['output']['suffix'], $link, array(
    'attributes' => array(
      'class' => array('mentions mentions-' . $user->uid),
      'title' => $text,
    ),
  ));

Which *appears* to have resolved the issue for me.

A patch attempt is forthcoming, just need to create the issue first. I think. I'm new to patches, please let me know if I goof something.

Comments

jweirather’s picture

StatusFileSize
new467 bytes

Attaching the patch. Tested applying against my own dev version and it appears to have worked.

jweirather’s picture

Title: "PHP Fatal error: [] operator not supported for strings" - (l() function class array) » WSOD, logged PHP error, when viewing user profile with mentions/statuses/plain text

Updated title

eiriksm’s picture

Status: Active » Reviewed & tested by the community

Can confirm this.

Can also confirm this is critical, since this totally breaks some pages.

Attached patch fixes the issue (was about to post a similar one myself)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1: fatal-error-class-array-2425443-2.patch, failed testing.

eiriksm’s picture

Status: Needs work » Needs review
StatusFileSize
new467 bytes

Weird whitespace issue in patch, possibly due to #2462661: mentions.module file issue?

Anyway, here is a clean(er) patch.

Status: Needs review » Needs work

The last submitted patch, 5: wsod_logged_php_error-2425443-5.patch, failed testing.

eiriksm’s picture

Status: Needs work » Needs review
StatusFileSize
new459 bytes

Ouch. You really should also look at the above mentioned issue. Trying this one, see if that works. Still same patch, only line ending changes.

Status: Needs review » Needs work

The last submitted patch, 7: wsod_logged_php_error-2425443-5.patch, failed testing.

eiriksm’s picture

Status: Needs work » Needs review
StatusFileSize
new459 bytes

OK, that was not easy. One more try.

Status: Needs review » Needs work

The last submitted patch, 9: wsod_logged_php_error-2425443-9.patch, failed testing.

eiriksm’s picture

Status: Needs work » Reviewed & tested by the community

OK, no idea how to create a patch that only touches this code, and still get it to apply. I could write a patch against the patched mentions.module file, but that would still not apply. Or a patch that also converts the line endings in the file, but that would of course be a large patch. Also, that patch already exists in #2462661: mentions.module file issue.

So just setting this to RTBC. I tested the patch and it works exactly as planned.

deciphered’s picture

Status: Reviewed & tested by the community » Fixed

Fixed and committed. Thanks for your hard work.

  • Deciphered committed f0449b1 on 7.x-1.x
    #2425443 by Deciphered, eiriksm: Fixed issue with classes.
    

  • Deciphered committed f0449b1 on 7.x-2.x
    #2425443 by Deciphered, eiriksm: Fixed issue with classes.
    

Status: Fixed » Closed (fixed)

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