It's an asymmetric world

Coredumps from Jesus Castagnetto's brain

  • Increase font size
  • Default font size
  • Decrease font size


Joomla! upgrading blues

E-mail Print PDF

After upgrading to Joomla! 1.0.10, all of sudden I started to get some nasty errors about redeclaring the PEAR class. Some diff-ing and hunting down for references to PEAR.php tracked down several include_once and require_once in Joomla! and some third party components, that were happily loading their bundled in version of PEAR.php (and other classes from PEAR).

If done correctly this should not be a problem, but in some cases it was not. In particular I did a quick fix (kludge) on 3 files and the problems with Docman failing were gone

The first one was in JOOMLA_DIR/includes/Cache/Lite.php (line numbers 468-475):

function raiseError($msg, $code) {
  //$path = dirname( __FILE__ ) . DIRECTORY_SEPARATOR .'includes'. 
  //        DIRECTORY_SEPARATOR .'PEAR'. DIRECTORY_SEPARATOR .'PEAR.php';
  $path = 'PEAR.php';   // JMC kludge
  if ( file_exists( $path ) ) {
    include_once( $path );
    PEAR::raiseError($msg, $code, $this->_pearErrorMode);
  }
}
The other 2 lines changed where in JOOMLA_DIR/administrator/components/com_docman/contrib/pear/HTML_Select.php (line numbers 22-28), which might actually have been the guilty code:
if(!class_exists( "PEAR")) {
    //require_once dirname(__FILE__) . '/PEAR.php';
    require_once 'PEAR.php';
}

//require_once dirname(__FILE__) . '/HTML_Common.php';
require_once 'HTML_Common.php';
Why so many applications bundled in PEAR and their components? I am not sure of the exact reasons, but one decides to do that, at the very least the code should be mangled to look for systemwide installed versions so as not to generate conflicts.

There are many other examples in the code for Joomla! and other packages, but I am too lazy to check them all out, just parsimoniously did the minimum to keep things going. Perhaps the Joomla! should have a smarter component installation logic, so if one bundles in an already installed library, it does not install just that bit. I know that could be a whole new can of worms, but it might be better for interoperatibility. Also, it might be a good idea to look at the new bits in the PEAR package description (2.0) to see if that provides them with the smarts needed.

 

Our son is here!

Our son Daniel Ken was born on March 09, 2009 at 14:39 PET (UTC - 5). We are happier than we've ever been in our lives.

Now the real work begins, helping a new life develop into this world.

-- Mom and Dad

My Random Photo

From Airin's Photo Gallery

Use OpenOffice.org
Green Hosting at Dreamhost.com

Visitors map

Anti-Spam Bots!