Posted by Triumphent on October 4, 2012 at 5:44am
6 followers
| Project: | Statuses (Social Microblog) |
| Version: | 7.x-1.x-dev |
| Component: | Code (API) |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Fatal error: Cannot use object of type stdClass as array in /home/example/public_html/sites/all/modules/statuses/includes/statuses.preprocess.inc on line 142
I get the above error when I visit a topic on my Advanced Forum page and the theming is lost.
How do I fix this?
Thanks. :)
Comments
#1
Duplicate of #1710880: Fatal error: Cannot use object of type stdClass as array in ....
#2
@mathankumarc
The previous post has been closed unresolved. A new thread is required.
#3
@Triumphent that's why I didn't closed the issue as duplicate :)
#4
Additional warning messages:
Warning: Cannot use a scalar value as an array in _statuses_links_sort() (line 140 of /home/example/public_html/sites/all/modules/statuses/includes/statuses.preprocess.inc).
Warning: Cannot use a scalar value as an array in _statuses_links_sort() (line 143 of /home/example/public_html/sites/all/modules/statuses/includes/statuses.preprocess.inc).
Warning: Cannot use a scalar value as an array in _statuses_links_sort() (line 143 of /home/example/public_html/sites/all/modules/statuses/includes/statuses.preprocess.inc).
Warning: Cannot use a scalar value as an array in _statuses_links_sort() (line 143 of /home/example/public_html/sites/all/modules/statuses/includes/statuses.preprocess.inc).
Warning: Cannot use a scalar value as an array in _statuses_links_sort() (line 143 of /home/example/public_html/sites/all/modules/statuses/includes/statuses.preprocess.inc).
Warning: Cannot use a scalar value as an array in _statuses_links_sort() (line 140 of /home/example/public_html/sites/all/modules/statuses/includes/statuses.preprocess.inc).
#5
As noted in that other thread, this is very likely due to another module conflicting. Resolving this requires figuring out what that other module is. @Triumphent, please run this code on your site (e.g. via /devel/php or previewing a node with the PHP input filter) and copy-paste the result here:
<?phpprint_r(module_implements('link'));
?>
That code should print out a list of the modules that implement hook_link(), which is what appears to be the conflict here.
#6
Here it is IceCreamYou:
Array
(
[0] => webform
[1] => flag
[2] => i18n_translation
[3] => statuses
)
In this case, it's got to be i18n_translation, which I installed a couple of weeks ago. Webform and flag have been on my site almost since I started it and never caused any trouble while I was setting up Statuses.
#7
There. I got he same six warnings as above but with an additional notice:
Notice: Undefined property: stdClass::$native in i18n_translation_link() (line 545 of /home/example/public_html/sites/all/modules/i18n/i18n.module).
That's the Internationalization module. A basic module required to have a site in several languages.
Here are lines 539 to 555 (as rendered by Komodo;)
539 * Build translation link
540 */
541 function i18n_translation_link($path, $langcode, $link = array()) {
542 $language = i18n_language_object($langcode);
543 $link += array(
544 'href' => $path,
545 'title' => $language->native,
546 'language' => $language,
547 'i18n_translation' => TRUE,
548 );
549 $link['attributes']['class'] = array('language-link');
550 // @todo Fix languageicons weight, but until that
551 if (function_exists('languageicons_link_add')) {
552 languageicons_link_add($link);
553 }
554 return $link;
555 }
#8
Ah, okay, thanks. Here is a patch that renames hook_link() to avoid this conflict. I haven't tested it but it's a pretty straightforward change (might require clearing the cache).
#9
Yes..! The patch is working great where I had the problem. It's fixed. Thank you. :)
#10
Great. Committed to dev.
#11
Here's my results in case it helps as I've been receiving the same error since updating recently:
Notice: Undefined index: enabled in statuses_all_contexts() (line 805 of /home/account/public_html/drupal/sites/all/modules/statuses/statuses.module).
[0] => webform
[1] => notifications_ui
[2] => special_menu_items
[3] => statuses
[4] => read_more
Looks like statuses and webform are common denominators.
I'll try out the new dev version. Thanks!
#12
Automatically closed -- issue fixed for 2 weeks with no activity.