Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#783 closed Bug (fixed)

Piwik includes wrong Zend library

Reported by: feyp Owned by: vipsoft
Priority: major Milestone: Piwik 0.4.1
Component: Core Keywords:
Cc: Sensitive:


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


I recently upgraded the Zend libarary in /opt/zend to 1.8.2 and got this error in the 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.

Change History (11)

comment:1 Changed 5 years ago by vipsoft (robocoder)

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').

comment:2 Changed 5 years ago by feyp

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.

comment:3 Changed 5 years ago by vipsoft (robocoder)

  • Resolution set to duplicate
  • Status changed from new to closed

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.

comment:4 Changed 5 years ago by vipsoft (robocoder)

  • Milestone set to 1 - Piwik 0.4.1
  • Resolution duplicate deleted
  • Status changed from closed to reopened

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.

comment:5 Changed 5 years ago by vipsoft (robocoder)

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

comment:6 Changed 5 years ago by vipsoft (robocoder)

  • Owner set to vipsoft
  • Status changed from reopened to new

comment:7 Changed 5 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:8 Changed 5 years ago by vipsoft (robocoder)

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

comment:9 Changed 5 years ago by vipsoft (robocoder)

(In [1357]) 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"

comment:10 Changed 5 years ago by alivenk

comment:11 Changed 5 years ago by koteiko

Note: See TracTickets for help on using tickets.