You need to check if those attributes exist, because the
onPrepareContent event is called by several different areas of Joomla,
not all of them sending in a full article. So you might just get an
object with a text attribute with the content to modify and nothing else.
Hannes
Am 27.02.2016 um 19:35 schrieb Ruud van Lent:
> Hi,
>
> A user of one of my plugins just reported the following notice:
> Notice: Undefined property: stdClass::$language in C:\web\IWWA\plugins\content\myplugin\myplugin.php on line 140
> Notice: Undefined property: stdClass::$fulltext in C:\web\IWWA\plugins\content\myplugin\myplugin.php on line 504
>
> when looking at those lines I have the following code:
>
> 140 > $url =
> JRoute::_(ContentHelperRoute::getArticleRoute($article->slug,
> $article->catid,*$article->language*), false, ($uri->isSSL() == '1' ?
> '1' : '-1'));
> 504 > preg_match_all('/<img .*src=["|\']([^"|\']+)/i',
> $article->introtext . *$article->fulltext*, $matches_image);
>
> It is a content plugin. The error generated is on a Joomla
> installation with flexicontent.
> So it looks like the $article->language and $article->fulltext are
> causing problems. Could this be because these are 'empty'?
>
> Could this be flexicontent related or is my code missing a check on
> the existence of these classes?
>
> Hope somebody can share a light :)
> --
> You received this message because you are subscribed to the Google
> Groups "Joomla! General Development" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
joomla-dev-gene...@googlegroups.com
> <mailto:
joomla-dev-gene...@googlegroups.com>.
> To post to this group, send email to
>
joomla-de...@googlegroups.com
> <mailto:
joomla-de...@googlegroups.com>.
> Visit this group at
https://groups.google.com/group/joomla-dev-general.
> For more options, visit
https://groups.google.com/d/optout.