Keyword

Notice: Undefined property: stdClass::$author ... Trying to get property of non-object

More
14 years 1 month ago #86142 by Jennifer Spencer
What steps will reproduce the problem?
1. Create a K2 article with author set to hidden (and php's error reporting is set to notice).
2. View the article in item layout
3. In some cases I got a notice message.

What is the expected output? What do you see instead?
I got 2 notice massages:
Notice: Undefined property: stdClass::$author in (...)\components\com_k2\views\item\view.html.php on line 58
Notice: Trying to get property of non-object in (...)\components\com_k2\views\item\view.html.php on line 58

What version of the product are you using? On what operating system?
2.3

Please provide any additional information below.
The line should be changed as follows for safer execution:
if (isset($item->author) && is_object($item->author->profile) && $item->author->profile->id > 0) {
(or load the author profile in any case in the model's prepare Item method)

Found on (code.google.com/p/joomlaworks/updates/list)

Please Log in or Create an account to join the conversation.

More
14 years 3 weeks ago #86143 by ruigato
is there any fix available for this?

Jennifer Spencer said:What steps will reproduce the problem? 1. Create a K2 article with author set to hidden (and php's error reporting is set to notice).
2. View the article in item layout
3. In some cases I got a notice message.

What is the expected output? What do you see instead?
I got 2 notice massages:
Notice: Undefined property: stdClass::$author in (...)\components\com_k2\views\item\view.html.php on line 58
Notice: Trying to get property of non-object in (...)\components\com_k2\views\item\view.html.php on line 58

What version of the product are you using? On what operating system?
2.3

Please provide any additional information below.
The line should be changed as follows for safer execution:
if (isset($item->author) && is_object($item->author->profile) && $item->author->profile->id > 0) {
(or load the author profile in any case in the model's prepare Item method)

Found on (code.google.com/p/joomlaworks/updates/list)

Please Log in or Create an account to join the conversation.

More
13 years 8 months ago #86144 by thejamkit
I tuned off Error reporting in Joomla! Global configuration under the server tab.... well actually set it up to default which I think is minimal, and doesnt show to the public end viewers. It may show up if you are logged in as an Administrator in the front end.

A patch or hack to this php file would really help though before the next release... any takers?

Please Log in or Create an account to join the conversation.

More
13 years 7 months ago #86145 by Ruud
Same here today after fiddling around with the Item View settings. Setting Error reporting in Joomla to Default solved it for now. Running K2 V2.4.1, patch would help!

Please Log in or Create an account to join the conversation.

More
13 years 6 months ago #86146 by stavroch

Please Log in or Create an account to join the conversation.

More
13 years 5 months ago #86147 by Birg

Please Log in or Create an account to join the conversation.

More
13 years 2 months ago #86148 by dvlancer
Just upgraded to 2.4.1 and have the same issue. Adding isset($item->author) fixed it.

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum