@anonymous-piwik-user opened this Issue on June 11th 2009

On my server, the default include path of PHP looks like this:

.:/usr/share/php:/opt/zend

I recently upgraded the Zend libarary in /opt/zend to 1.8.2 and got this error in the Piwik.org Blog plugin:

File "Com.php" was loaded but class "Zend_Validate_Hostname_Com" was not found in the file

After I removed /opt/zend from the include path for Piwik's virtual host, the error was gone.

It seems that Piwik somehow handles inclusion of the Zend library in the wrong way. If Piwik handled the include path correctly, there should be no interference of the library in /opt/zend with the one shipped by Piwik, because the working directory (".") is always checked first.

@robocoder commented on June 11th 2009 Contributor

Are ini_set() or set_include_path() disabled in your php configuration?

In 0.4's piwik/index.php and piwik/piwik.php, any existing include path is appended to the absolute paths specified by Piwik (eg PIWIK_INCLUDE_PATH . '/core').

@anonymous-piwik-user commented on June 11th 2009

I did a little debugging: In libs/Zend/Validate/Hostname/Hostname.php is a line (no. 325), that tries to load the file Zend/Validate/Hostname/$tld.php, if Zend_Loader->isReadable($file) is true. Zend_Loader->isReadable() checks for each directory in the include path, if such a file exists and returns true, if it exists and a class exists in the file. If the file exists, but a class does not exist, it throws the exeception I encountered above.

To be fair, this is really a problem with Zend_Framework and not with Piwik. On the other hand, this wouldn't be a problem, if Piwik did not append the preset include path in /index.php like you pointed out above. There isn't really a reason to do that, I think. So my suggestion would be: Know where you need to include. Put that in the include path. Ditch everything else.

@robocoder commented on June 11th 2009 Contributor

It's not that simple, but this should be fixed when we update Piwik's version of ZF -- and we already have a ticket open for this task.

@robocoder commented on June 11th 2009 Contributor

Proposal: don't add/append/prepend the existing include path to the new include path. AFAIK, Piwik ships with no external ZF/PEAR/Smarty dependency.

@robocoder commented on June 11th 2009 Contributor

(Sorry, I had re-read freyp's comment and then it sunk in.)

@robocoder commented on June 11th 2009 Contributor

(In [1205]) Fixes #783 - don't append preset include path; thanks feyp.

@robocoder commented on June 11th 2009 Contributor

(In [1207]) Fixes #788, refs #783 - fix include path issues

@robocoder commented on August 2nd 2009 Contributor

(In [refs #783 - more include (search) path changes to handle either (but not both) disabled ini_set() or set_include(); also avoid "apc-error) Cannot redeclare class piwik_version"

This Issue was closed on August 14th 2009
Powered by GitHub Issue Mirror