Topic-icon Undefined variable: articleText - on line 345

11 years 5 months ago #28474 by rikbro
I just upgraded yesterday to JFBConnect using JFBConnect-4.3-Joomla25_20121206_unzip_first.zip (with Joomla 2.5.8). I'm now getting the following error message twice at the very top of each page when the plugin "System - JFBCSystem" is enabled:

Notice: Undefined variable: articleText in /home/www/html/subs/joomla/libraries/sourcecoast/articleContent.php on line 345

I've disabled every other JFBC plugin/module so that only the system plugin is enabled.
I've tried several templates including the Beez5 (default) with the same outcome.

Any ideas?

Thanks. -- Rik
The topic has been locked.
Support Specialist
11 years 5 months ago #28481 by alzander
Rik,
I'm a bit perplexed by that notice. That line number, in the latest release, doesn't have that variable name (articleText).

All I can think is that our library wasn't updated properly when you installed JFBConnect again. Can you go to the Joomla Installer -> Manage area and search for "SourceCoast". You should see "SourceCoast Extensions Library". Make sure the version number is 1.0.9.

Let us know how if that's right or wrong and we can go from there on what to do next.

Beyond that, you can change the Error Reporting setting in Joomla's Global Config area to "None". That will hide the message, but we should still try to figure out what's causing it in case it's causing any functional problems (like missing Like/Comment widgets).

Thanks,
Alex
The topic has been locked.
11 years 5 months ago #28487 by rikbro
Alex:

Thank you for your reply. The library does show as version 1.0.9 (2012/12/05). And, it appears that when JFBConnect was previously enabled, some of the widgets may not have been working (unless I had something misconfigured).

Although I changed the Joomla Error Reporting server setting to "None," the same error lines indicated above were still being displayed when the JFBC system plugin was enabled and I accessed pages. I found that I also needed to set "display_errors = Off" in the server's php.ini. However, that isn't too good since I'm now operating somewhat in the blind.

By the way, the pages on our site are JReviews listings.

I'm open to more suggestions.

Thanks. -- Rik
The topic has been locked.
Support Specialist
11 years 5 months ago #28491 by alzander
Rik,
The php.ini setting has the same effect as the Joomla Configuration option, but sometimes servers are setup to prevent the method that Joomla uses. I completely agree that it's not good to be blind to those notices, but on a production site, you should only show those types of messages when you're testing/debugging. You don't want them displayed always.

Obviously, that doesn't mean we shouldn't fix that problem. We are looking into it, but still a bit confused as to why that line you mention doesn't line up with what was in our release. It makes us think that the articleContent.php file wasn't properly updated with the new release, which would be bad.

Can you try the following:
* Disable the JFBCSystem and JFBCContent plugins
* Rename the /libraries/sourcecoast/articleContent.php file to articleContent_old.php
* Install JFBConnect one more time (you don't need to uninstall first).

Check to make sure the articleContent.php file was recreated. If so, re-enable the plugins and test. If not, copy the _old file back to articleContent.php and re-enable the plugins and let us know. In that case, it sounds like there's some permission issue that is preventing that file from being written.

Hope that helps, and keep us posted,
Alex
The topic has been locked.
11 years 5 months ago #28494 by rikbro
Alex:

I did a re-install per your three bullet points above and everything appears to be working.

One thing I noticed in the /libraries/sourcecoast/ directory is that the dates of the two files differed by 2 minutes although the file sizes were the same:

-rw-r--r-- 1 apache apache 17243 Dec 8 14:12 articleContent.php
-rw-r--r-- 1 apache apache 17243 Dec 8 14:10 articleContent.php.OLD

Anyway, JFBConnect now looks to be working properly. Thank you for all of your help. -- Rik
The topic has been locked.
Support Specialist
11 years 5 months ago #28501 by alzander
The creation date for the .OLD file is probably from just when you copied it over there, not the actual creation date from when we created it. Same for the new file, it's just when it was created on your system... 2 minutes after you renamed the previous file.

Glad to hear that got you going. Honestly can't imagine what changed since the files are the same size, but something was definitely odd.

Certainly if you run into other issues or have any questions, just let us know.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 5 months ago #28508 by FMO
I have the same issue on my site and it's the first time I install JFBConnect. I tried all the steps as described previously:
* Disable the JFBCSystem and JFBCContent plugins
* Rename the /libraries/sourcecoast/articleContent.php file to articleContent_old.php
* Install JFBConnect one more time (you don't need to uninstall first).
The articleContent.php was created and I unabled the system and content plugin. However the message error still appearing on the top of every content page. As Rik, I'm using Jreviews 2.4
EDIT: I tried to set the Error Reporting to None but still displaying the error on listing front pages...
Hope you will be able to help :/
Thx
The topic has been locked.
Support Specialist
11 years 5 months ago #28510 by alzander
We were wrong above. We've found the issue and are looking into it further and should hopefully have a minor code change you can use shortly to get rid of that notice. In the meantime, please note:
* That it is only a PHP Notice, which means there's nothing critical going wrong on the site.
* Setting Error Reporting to None should get rid of the message
* Once you change the error reporting setting, make sure you clear your Joomla cache as the message may have been saved in the cache and will still display until that's regenerated (or cleared).

Hope that helps, and sorry for the confusion,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 5 months ago #28517 by FMO
Thanks for your reply. As Rik, I had to ask to my hosting to make a change in the php.ini ; clearing the cache doesn't solved in my case.
Please, keep us updated cause I think better to turn on the error reporting in php.ini as soon as we are able to implement the code change.

Thanks
The topic has been locked.
Support Specialist
11 years 4 months ago #28840 by alzander
Very sorry for the delay in getting back to this post. It slipped off my radar, and I apologize for that.

If you are unable to disable error reporting on your stie, the minor code change below will fix the issue altogether. We're investigating if there's other changes we should make as well, but this will definitely get you going for now. The next release will have a fix for this issue as well.

To fix that notice, please edit the /libraries/sourcecoast/articleContent.php file. Around line 335, you'll see:
static function getFirstArticleText($article, $numCharacters = 100, $socialGraphFirstText='1') 
    { 
        if(isset($article->introtext) && trim(strip_tags($article->introtext)) != "")
Change that to:
static function getFirstArticleText($article, $numCharacters = 100, $socialGraphFirstText='1') 
    { 
        $articleText = ''; // <------- ADD THIS 
        if(isset($article->introtext) && trim(strip_tags($article->introtext)) != "")
That's it, and it should get rid of the notices.

Thanks for your patience,
Alex
The topic has been locked.