Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Piwik includes wrong Zend library #783

Closed
anonymous-piwik-user opened this Issue · 8 comments

2 participants

@anonymous-piwik-user

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
Collaborator

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

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
Collaborator

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
Collaborator

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
Collaborator

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

@robocoder
Collaborator

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

@robocoder
Collaborator

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

@robocoder
Collaborator

(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"

@anonymous-piwik-user anonymous-piwik-user added this to the Piwik 0.4.1 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.