When using a Views(7.x-3.8) view to override the default output of /blog/% the following error is generated.

Notice: Trying to get property of non-object in blog_menu_local_tasks_alter() (line 155 of /XXX/modules/blog/blog.module).

The error is not generated for the override of /blog with a Views view.

Comments

dcam’s picture

Is this a Views issue or an issue with Drupal core?

Lostboy22’s picture

The notice is from a line in core.....

dcam’s picture

Yes. I saw that. It doesn't automatically mean that core is at fault. Also, it's not uncommon for people to post issues they know are caused by contrib modules in the core queue, not realizing they should post it in that module's queue. I had to ask.

I'll see what I can find out about the problem.

maxrys’s picture

I have this bug too when i override path "blog/%" with Views!
I analyze blog_menu_local_tasks_alter: $router_item['page_arguments'] == Array (VIEW_NAME, VIEW_PAGE_NAME, USER_ID);
Maybe it's bug of Views module.
Right code:
- elseif ($root_path == 'blog/%' && $router_item['page_arguments'][0] == $user->uid) {
+ elseif ($root_path == 'blog/%' && arg(1) == $user->uid) {

Lostboy22’s picture

I have this bug too when i override path "blog/%" with Views!
I analyze blog_menu_local_tasks_alter: $router_item['page_arguments'] == Array (VIEW_NAME, VIEW_PAGE_NAME, USER_ID);
Maybe it's bug of Views module.
Right code:
- elseif ($root_path == 'blog/%' && $router_item['page_arguments'][0] == $user->uid) {
+ elseif ($root_path == 'blog/%' && arg(1) == $user->uid) {

Where did you make the change?

Juanpgs’s picture

Hi, I am getting the same error "Notice: Trying to get property of non-object in blog_menu_local_tasks_alter() (line 155...blog.module)."

any solution?

Anonymous’s picture

This issue is present in 7.34 as well when using views and giving the path of the Page Display to blog/%.

I am using the Core blog module

dcam’s picture

klokie’s picture

Version: 7.28 » 7.34

This issue still persists, though the fix suggested in #1160926-3: Blog module conflicts with other URL routes beginning with "blog/" fixes it.

Version: 7.34 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.