Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piwik includes wrong Zend library #783

Closed
anonymous-matomo-user opened this issue Jun 11, 2009 · 8 comments
Closed

Piwik includes wrong Zend library #783

anonymous-matomo-user opened this issue Jun 11, 2009 · 8 comments
Assignees
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@anonymous-matomo-user
Copy link

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
Copy link
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-matomo-user
Copy link
Author

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
Copy link
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
Copy link
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
Copy link
Contributor

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

@robocoder
Copy link
Contributor

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

@robocoder
Copy link
Contributor

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

@robocoder
Copy link
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants