AJAX Scroller - conflicts with other RSS modules that use simplepie library

14 years 3 months ago #5186 by mblodau
Hi there,

i noticed a conflict between Ajax Scroller and other RSS extensions that use the simplepie library.

In this case i tried to use the "Slick RSS" module. When both modules are activated i get a fatal error on the page:

"Fatal error: Cannot redeclare class SimplePie_Cache_MySQL in /home/tu/public_html/libraries/simplepie/simplepie.php on line 9069"


Website is: www.tu.se

Did some research on that error and figured out that the reason is that both modules try to include the simplepie.php library.

The solution is to check if the SimplePie class already exists before running an include.

I checked the source code of mod_slick_rss and saw that they have a security check around their simplepie.php include.

Since Ajaxscroller is Ioncube encoded i can't see if you just include the simplepie class or also have a security check around it.

Because of the encrypted code i have to assume that the Ajaxscroller causes the problem because you include the simplepie.php without first doing a check if that class already exists.

Could you please reply and confirm or deny this assumption?

The include in the Ajaxscroller should look like this in order to be compatible with other Joomla extensions that use RSS.
if(!class_exists('SimplePie')){
     //include Simple Pie processor class
     require_once (JPATH_SITE.DS.'libraries'.DS.'simplepie'.DS.'simplepie.php');
}

Best regards,

Martin Blodau
Pixpro Stockholm

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

14 years 3 months ago #5191 by Saka
I don't have access to the code right now but I will check shortly and let you know.

Emir Sakic
www.sakic.net

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

14 years 3 months ago #5195 by Saka
Hello again.

My module is using Joomla's own API for including this class:
jimport ('simplepie.simplepie');
This function is already taking care about double inclusion etc.

So you should just replace this code
if(!class_exists('SimplePie')){
     //include Simple Pie processor class
     require_once (JPATH_SITE.DS.'libraries'.DS.'simplepie'.DS.'simplepie.php');
}
with
jimport ('simplepie.simplepie');
in the module in question and it should work fine.

Seems like the issue has been already discussed here: joomlacode.org/gf/project/joomla/tracker...racker_item_id=16906

Emir Sakic
www.sakic.net

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

About us

We provide high quality Joomla components created by a co-founder and original core developer of Joomla. For over a decade, our products have been used by more than 20.000 webmasters around the world.

Stay in touch