golfads VIP
Total posts: 216
25 Apr 2013 03:34

We are using latest version of Cobalt (8.46) with Joomla 3.0.3, at some occasions, while changing page on our website, we got the following error with a blank page:

Fatal error: Cannot redeclare class Url in /.../components/com_cobalt/library/php/helpers/url.php on line 12

Much more important, we are also using MijoShop to offer a shopping space to our users and we are not able to access the shopping page on the website frontpage as we are getting this same error with a blank page and on MijoShop page this is a permanent error:

Fatal error: Cannot redeclare class Url in /.../components/com_cobalt/library/php/helpers/url.php on line 12

You may see this error live on the link http://www.golfads.info/en/online-golf-shopping.html

Please, do get back to us as soon as possible as we need to launch our website by beginning of next week latest.

Last Modified: 02 Mar 2014


Sergey
Total posts: 13,748
25 Apr 2013 13:08

Unfortunately this is conflict with other extension which has the same class name. I know it was stupid to use so common name for this class. But this stupidity was done on both sides. :D

The error you copy here is not full. It also have to say where this class was already declared to know what extension is conflicting.

Unfortunately in the stage we are now we cannot change this class because it is very widely used. We are about to become stable and change the class will require a lot of people revise their custom templates. But we want provide safe updates. We only can change it in Cobalt 9 on general version key update.

To resolve this conflict I would only ask you contact extension developer on the other side of the conflict with request to resolve. Perhaps changing their class name will not be so dramatic.


golfads VIP
Total posts: 216
30 Apr 2013 05:13

Hi,

Having no other alternatives, I contacted Mijo guys again and ask them to fix the problem as my website could not go online with such 'error', they did it, in fact, they did not change their 'URL' class within MijoShop itself, but only for my own website, that means, anyone using Cobalt 8 and MijoShop on the same website later will get the same error!

Also, they advised me not to upgrade or re-install mijoshop as the error will come back :(

Anyway, for now, the problem is solved and our development process can go on.


golfads VIP
Total posts: 216
30 Apr 2013 05:46

Here is the solution provided by mijo team to avoid such conflict:

\components\com_mijoshop\mijoshop\router.php

  • line 138: self::$url = new Url(HTTP_SERVER, self::$config->get('config_secure') ? HTTPS_SERVER : HTTP_SERVER);

  • line 138: self::$url = new Mijosoft\Url(HTTP_SERVER, self::$config->get('config_secure') ? HTTPS_SERVER : HTTP_SERVER);

  • line 141 : self::$url = new Url(self::$config->get('config_url'), self::$config->get('config_secure') ? self::$config->get('config_ssl') : self::$config->get('config_url'));

  • line 141 : self::$url = new Mijosoft\Url(self::$config->get('config_url'), self::$config->get('config_secure') ? self::$config->get('config_ssl') : self::$config->get('config_url'));

\components\com_mijoshop\opencart\system\library\url.php

add following line

namespace Mijosoft;

before following line

line 14 : defined('_JEXEC') or die('Restricted access');

Powered by Cobalt