Site Warnings

bodyblueprinter's picture

Hi Everyone how have you been?

I was working on my site and trying to get content viewing permissions straightened out for my needs when I noticed this warning when trying to look at specific pieces of content:

Notice: Trying to get property of non-object in node_node_access()

The content is displayed as it should be, but the problem is that the warning is distracting and it displays file path....not wanting that

The code on that line is:

line 3083: function node_node_access($node, $op, $account) {

line 3084: $type = is_string($node) ? $node : $node->type;

But I don't know what or how to fix? Any thoughts or direction is appreciated.
Tobin

Comments

If $node is a number, because

darrylri's picture

If $node is a number, because someone is passing in a nid, then you'd get that kind of a message. You might need to find the code that is calling this.

Could be done by temporarily adding
if (is_numeric($node)) drupal_set_message(print_r(debug_backtrace(),TRUE));

Alternatively, if you have a debugger set up, you should be able to breakpoint on this.

Thanks Darryl

bodyblueprinter's picture

The only number I can think of is UID. I have field permission module installed so that User Reference field cannot be changed from original content.

Where would I add the temporary code?

What kind of debugger are you mentioning?

Tobin

I would put it between 3083

darrylri's picture

I would put it between 3083 and 3084. When your page comes up, you may see a large message at the top of the screen with a backtrace. Look at the page source to see it formatted a bit nicer. You can see each function that is called and its arguments in gruesome detail.

If you're using an IDE like Eclipse or PHPStorm, you can usually configure a debugger, like XDebug, to run against a local server. Can be annoying to setup.

Thanks again Darryl

bodyblueprinter's picture

I will check this out.....

Not running on a local server, so I will check with host :)

Have a good one.