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.
Hi, I was perusing my site as a non-admnistrator and while clicking around I received this message twice, then it disappeared.
Notice: Trying to get property of non-object in widgets_build_cache_cid() (line 1200 of /home/corpora1/public_html/sites/all/modules/widgets/widgets.module).
I do not have Widget Service Links enabled.
Any help would be great, I don't want anonymous visitors to be freaked out by random error messages on the site :)
thanks.
Comment | File | Size | Author |
---|---|---|---|
#7 | widgets.module.TXT | 44.4 KB | pverrier |
#6 | ErrorMessageTryingToGetPropOfNonObject-1414932-6.patch | 787 bytes | pverrier |
#2 | widgets-1.0-beta5.module.patch | 771 bytes | pverrier |
Comments
Comment #1
TomDude48 CreditAttribution: TomDude48 commentedCan you tell me the path of the page you were on?
Comment #2
pverrier CreditAttribution: pverrier commentedI have the same kind of notice in another context :
" Notice : Trying to get property of non-object dans widgets_get_context_author_uid() (ligne 1300 dans C:\wamp\www\rdj3\sites\all\modules\widgets\widgets.module). "
I created some views in order to show data in a "user space" : /user/%/publications (list of the nodes he published), /user/%/comments, and so on (where % is a UID).
I have this notice only in these pages, the concerned code being :
especially line 1300 because
arg(0) == 'user' && is_numeric(arg(1))
is true, andmenu_get_object('user', 1)
is null in this context.I think something is missing here :
Since the user object seems to be loaded in other contexts than user/% (like user/%/socialmedia), the second solution is better.
In my case, directly using arg(1) instead of menu_get_object() would do the trick, but I think it's better to implement my special needs in the alter function.
I suggest a patch below, also covering the node context case few lines above. Perhaps will be a solution for @flock since widgets_build_cache_cid() calls widgets_get_context_author_uid() (?)...
Comment #3
dddave CreditAttribution: dddave commentedCorrecting status (don't have the issue btw).
Comment #4
vaibhavroys CreditAttribution: vaibhavroys commentedwhere should i paste this patch please give a brief explanation
.
Comment #5
dddave CreditAttribution: dddave commentedHere is a good tutorial about applying patches: http://drupal.org/node/620014
Comment #6
pverrier CreditAttribution: pverrier commentedI made the first patch with svn.
This one is made with git on current dev version.
Comment #7
pverrier CreditAttribution: pverrier commentedModified file from beta5 will be easier to use directly...
Comment #8
rsvelko CreditAttribution: rsvelko commentedthe patch from #6 fixed it for me. D7, php 5.3
the patch code seems quite logical.
Comment #9
TomDude48 CreditAttribution: TomDude48 commentedpatch applied. Thanks pverrier!
Comment #10
pverrier CreditAttribution: pverrier commentedYou're welcome! :)
Comment #11
TomDude48 CreditAttribution: TomDude48 commentedNo more error reports, assuming fixed.