I get Fatal error: using $ this if not in the object context in Stemmer.php on line 317.
I am currently using the Stemmer class that I found on the Internet to change words to their original version before looking for a database for matches.
I have read all the related posts in which people are faced with a similar problem. The difference is that the code causing the error is definitely in the context of the object (the code below will show this). Another strange thing is that there are parts of the code that are very similar to the error before and after it, which do not seem to create any difficulties. At different times, the error line has changed to some of these lines.
Does anyone have any ideas what might cause the problem. I use php5.1.34 if that matters.
Code that calls the Stemmer class
if (isset($search) && $search != "") {
$filtered_words = WordFilter::filter($search);
foreach($filtered_words as $word) {
if(strlen($word) <= 2) {
continue;
}
$w = Stemmer::stem($word);
$stemmed_words[] = $w;
}
}
Stemmer Class:
class Stemmer
{
...
if ( strlen($word) > 2 ) {
**$word = $this->_step_1($word);**
}
...
}
Even when an error occurs in difference places in the code, it always seems that when there is code trying to call another method within the same class. Maybe this is a bug in php5 that I don't know about? Any advice would be most appreciated.
Thanks Archie
source
share