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:

  1. Disable Boost
  2. Disable Search By Page Nodes
  3. Set system_run_automated_cron to always run cron
  4. Visit a page on the site (either logged in or anonymous)
  5. Log has a bunch of errors of the form "Content was skipped" which I'm assuming (hoping) are not big deal.
  6. Enable Search by Page Nodes
  7. Visit a page on the site (either logged in or anonymous)
  8. Log has a bunch of errors of the form "Trying to get property of non-object in node_page_title".
  9. Disable Menu Block
  10. Visit a page on the site (either logged in or anonymous)
  11. 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?

Files: 

Comments

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

Priority:Normal» Major

Hi!

This error occurs every time when some page or content is edited and saved.

  1. If "provide menu link" is not checked => no errors
  2. If "provide menu link" is checked first time and save pressed => no errors
  3. if "provide menu link" has already been checked and save is pressed => Notice
  4. If "provide menu link" has already been checked and menu name is modified + save pressed => no errors

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.

Is there already a solution for this bug?
I have it too.
Someone kindly provide the info to fix it.

Thank you!

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

Have same issue. Latest stable versions. Menu_block and Search_by_page enabled. All the log consists of this kind of notices.

Same 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

        $item['title'] = call_user_func_array($callback, menu_unserialize($item['title_arguments'], $map));

with
        $item_unserialized = menu_unserialize($item['title_arguments'], $map);
        if (is_object($item_unserialized)){
          $item['title'] = call_user_func_array($callback, $item_unserialized);
        }

What happens here is that $map supposed to contain object type and object itself
$map = array('node', $node_object);

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.

For 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 error
Notice: 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.

Have same issue. Latest stable versions. Menu_block and Search_by_page enabled

same 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

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

thx @pjcdawkins.

so now there are a few questions:

  1. what causes this entrys? (the upgrade to 7.12? any module/module combination?)
  2. is it save to delete this wrong menu_links? (are there corresponding menu_node entrys?

by the way:
workaround #7 breaks the display of some admin_menu items.
maybe this would be better as an temporarly workaround:

        $item_unserialized = menu_unserialize($item['title_arguments'], $map);
        if (is_object($item_unserialized) || $callback != 'node_page_title') {
          $item['title'] = call_user_func_array($callback, $item_unserialized);
        }

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

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

Comments #8, #10, #11, #12, and #14 are a side-track (sorry, my fault). The issue described in the OP stands.

what 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

#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?

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

This issue in the Menu Browser module may be related to #11, #12, #14 and #15.
#1372972: Duplicate Menu Items

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

Status:Active» Postponed (maintainer needs more info)

The bug description is all over the place. Please clarify. Preferably with steps to reproduce.

Status:Postponed (maintainer needs more info)» Closed (fixed)

Actually, 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.

If you are seeing

Trying to get property of non-object in node_page_title

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.