I have reported this bug in the Search by Page queue, but I'm also reporting in here, because I'm not sure in which module the bug lies. When cron runs triggered by a page view, node_page_title sometimes gets passed an integer instead of a node, so I get the following error:
Notice: Trying to get property of non-object in node_page_title() (line 2075 of /path/to/site/modules/node/node.module
This bug requires both a page with a menu block and the Search by Page Nodes module to be active. I've been modifying system_run_automated_cron to always run cron, regardless when it was last run, which helps speed up my debugging. Here are the steps I'm following:
- Disable Boost
- Disable Search By Page Nodes
- Set system_run_automated_cron to always run cron
- Visit a page on the site (either logged in or anonymous)
- Log has a bunch of errors of the form "Content was skipped" which I'm assuming (hoping) are not big deal.
- Enable Search by Page Nodes
- Visit a page on the site (either logged in or anonymous)
- Log has a bunch of errors of the form "Trying to get property of non-object in node_page_title".
- Disable Menu Block
- Visit a page on the site (either logged in or anonymous)
- Log has a bunch of errors of the form "Content was skipped" which I'm assuming (hoping) are not big deal.
The stacktrace in node_page_title when the error is thrown is these functions:
node_page_title, call_user_func_array, _menu_item_localize, _menu_link_translate, _menu_tree_check_access, menu_tree_check_access, menu_build_tree, menu_tree_page_data, menu_tree_add_active_path, menu_tree_build, menu_block_block_view, call_user_func_array, module_invoke, _block_render_blocks, block_list, block_get_blocks_by_region, execute, context_page_build, search_by_page_page_content, search_by_page_update_index, call_user_func_array, module_invoke, search_cron, call_user_func_array, module_invoke, drupal_cron_run, system_run_automated_cron, drupal_page_footer, drupal_deliver_html_page, drupal_deliver_page, menu_execute_active_handler
Any thoughts?
Comment | File | Size | Author |
---|---|---|---|
#4 | Screen shot 2012-01-24 at 9.52.29 AM (2).png | 96.04 KB | drupalfantwo |
Comments
Comment #1
somanyfish CreditAttribution: somanyfish commentedI also want to flag this post as being related: Improper usage of node_page_title() function by _menu_item_localize() function in includes/menu.inc
Comment #2
Fred8 CreditAttribution: Fred8 commentedI think this error first appeared after I battled with DHTML menu - it does not expand in the Management section. I disabled and enabled DHTML, and tried different settings, and after that, when saving a content page, it showed this error.
Comment #3
tepheikk CreditAttribution: tepheikk commentedHi!
This error occurs every time when some page or content is edited and saved.
It seems that if content is edited with provided menu link. And menu information itself is not changed (turn off/on or renamed) this notice occurs. I hope that this helps pinpointing the source of problem.
Comment #4
drupalfantwo CreditAttribution: drupalfantwo commentedIs there already a solution for this bug?
I have it too.
Someone kindly provide the info to fix it.
Thank you!
Comment #5
bevision CreditAttribution: bevision commentedI am also getting this. I also get the error when running any Search with Search by Page. Is there any fix or workaround available at this point?
Comment #6
conspirolog CreditAttribution: conspirolog commentedHave same issue. Latest stable versions. Menu_block and Search_by_page enabled. All the log consists of this kind of notices.
Comment #7
alex.skrypnykSame happen to me after update to D7.12 and new menu_block version 7.x-2.3.
As a quick dirty fix, I had to patch core (just really needed to get rid of this errors today), replaced in menu.inc around line 700
with
What happens here is that $map supposed to contain object type and object itself
This gets loaded in function _menu_load_objects in couple of calling functions "above", but somehow, it sometimes returns properly loaded $node_object and sometimes - just a string with a $node_id.
Now, I did not have the time to dig deeper into _menu_load_objects, but maybe something wrong there.
Comment #8
pjcdawkins CreditAttribution: pjcdawkins commentedFor me, since upgrading from Drupal 7.11 to 7.12, attempting to view a node page with Menu Block enabled causes an out of memory error (despite a
memory_limit
of 512MB). The errorNotice: Trying to get property of non-object in node_page_title() (line 2075 of modules/node/node.module).
is repeated thousands of times in watchdog, and it's presumably the error logging which is using up memory.
I can get around the out of memory error if I disable Menu Block, or if I turn off strict error reporting, e.g.
error_reporting(E_ALL)
in settings.php.Comment #9
cjamesrun CreditAttribution: cjamesrun commentedHave same issue. Latest stable versions. Menu_block and Search_by_page enabled
Comment #10
Shuairan CreditAttribution: Shuairan commentedsame problem here. the workaround from #7 seems to work, but the error must be somewhere else.
so I debugged for some time now and found some strange database entries in the "menu_links" table.
there are a bunch of (42314!) entries where the col menu_name says '0'. But I have not menu named '0' ;D
by now I don't know how exactly to fix this, and why these entries are loaded during page requests.
so maybe you can check your databases for that, and report it here. to specify if thats the general problem or only the reason for the problem on my site... :)
SELECT count(*) FROM `metz`.`menu_links` where menu_name='0'
=> 42314
Comment #11
pjcdawkins CreditAttribution: pjcdawkins commented@Shuairan:
I have 30,956 menu links where the menu_name is '0' (and 32,041 menu links in total). That doesn't sound right to me either...
Comment #12
Shuairan CreditAttribution: Shuairan commentedthx @pjcdawkins.
so now there are a few questions:
by the way:
workaround #7 breaks the display of some admin_menu items.
maybe this would be better as an temporarly workaround:
Comment #13
cjamesrun CreditAttribution: cjamesrun commentedFor my site almost every page refresh is throwing the error into the log, so the log is filling up fast. I don't have the extra menu items #11 and #12 are having.
Comment #14
pjcdawkins CreditAttribution: pjcdawkins commented@Shuairan
DELETE FROM {menu_links} WHERE menu_name = '0'
(N.B. make sure it is '0', not 0)
This works for clearing up my 31,000 dud entries, and it's solved my WSODs from #8. So finally I can use Drupal 7.12. No idea what caused them in the first place, that's quite worrying.
Comment #15
pjcdawkins CreditAttribution: pjcdawkins commentedComments #8, #10, #11, #12, and #14 are a side-track (sorry, my fault). The issue described in the OP stands.
Comment #16
itz_andr3 CreditAttribution: itz_andr3 commentedwhat is OP 'stands' means?
btw, i found other solution just to baypass the error notice
here http://drupal.org/node/1477608
still no clue on how this happened at the first place,
on my case, this happened after i add menu link (first time from fresh complete install)
but strange thing on me,
SELECT count(*) FROM `menu_links` where menu_name='0'
return 0
even after i short by menu_name, i dont see any 0 value
Comment #17
cjamesrun CreditAttribution: cjamesrun commented#16 solved the issue, but it is a core hack, so I don't like using it.
Poster #2 and #3, how did you clear the error?
Comment #18
lmeurs CreditAttribution: lmeurs commentedIn our case this was caused by calling
menu_set_active_item($path)
to alter the active trail, where $path was the path to a node that was not added to a menu yet.Comment #19
pjcdawkins CreditAttribution: pjcdawkins commentedThis issue in the Menu Browser module may be related to #11, #12, #14 and #15.
#1372972: Duplicate Menu Items
Comment #20
lorenz CreditAttribution: lorenz commentedI disabled the menu link - node menu on my drupal commerce kickstart installation and the error went away, instead the error changed to:
Notice: Undefined index: summary in node_tokens() (line 142 ... modules/node/node.tokens.inc).
That error in turn went away when I enabled translation for a certain content type in the content types settings.
Comment #21
JohnAlbinThe bug description is all over the place. Please clarify. Preferably with steps to reproduce.
Comment #22
JohnAlbinActually, test the latest 7.x-2.x-dev and if you are still experiencing the bug (whatever it is), please re-open with steps to reproduce.
Comment #23
rooby CreditAttribution: rooby commentedIf you are seeing
errors, you may also try this issue: #1697570: _menu_load_objects() is not always called when building menu trees
Based on the stack trace in the original post I would say this is a duplicate of that issue.