Update to v2.02 error

(Edoardo) #1

Hi there,

I upgraded from 1.54 to 2.02 and now every page of piwik if prepended by 3 instance of this.

There is an error. Please report the message (Piwik 2.0.2) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).

Warning: file_exists(): open_basedir restriction in effect. File(plugins/Morpheus/stylesheets/ieonly.css?cb=09205c7f57e6d7c42a8e7b351a87f0be) is not within the allowed path(s): (C:\Inetpub\temp;D:\Inetpub) in D:\Inetpub\WWWRoot\piwik\core\Theme.php on line 133

Backtrace -->

#0 Piwik\Error::errorHandler(…) called at [:]
#1 file_exists(…) called at [D:\Inetpub\WWWRoot\piwik\core\Theme.php:133]
#2 Piwik\Theme->rewriteAssetPathIfOverridesFound(…) called at [:]
#3 preg_replace_callback(…) called at [D:\Inetpub\WWWRoot\piwik\core\Theme.php:100]
#4 Piwik\Theme->rewriteAssetsPathToTheme(…) called at [D:\Inetpub\WWWRoot\piwik\core\View.php:257]
#5 Piwik\View->renderTwigTemplate(…) called at [D:\Inetpub\WWWRoot\piwik\core\View.php:248]
#6 Piwik\View->render(…) called at [D:\Inetpub\WWWRoot\piwik\plugins\UsersManager\Controller.php:178]
#7 Piwik\Plugins\UsersManager\Controller->userSettings(…) called at [:]
#8 call_user_func_array(…) called at [D:\Inetpub\WWWRoot\piwik\core\FrontController.php:117]
#9 Piwik\FrontController->dispatch(…) called at [D:\Inetpub\WWWRoot\piwik\index.php:71]

Files are actually inside the open_basedir directive restrictions but fail to be recognized as such.

Is there a fix for this?

Thank you.


that upgrade path is really big what if you were to take it into 2 stages… there has been so many database changes. so if you wnet from

1.54 to 1.12 then 1.12 to 2.02.?

(Edoardo) #3

Actually I upgraded straight thru and I believe the database upgrade completed fine.
It looks like is just a theming issue: I’m no expert here but… the file_exists is checking a file on the filesystem without building the proper path?

Thank you.

(Edoardo) #4

Oh, I found out.

Looks like in Windows, the php core function file_exists($file) goes “banana” if you leave the querystring on the file.
I fixed the core\theme.php stripping the querystring, if any, before checking for file existance (is somebody needs the code, lmk).

This is a bug of Piwik, can someone help me report it?

Thank you.

(Edoardo) #5

Never mind, I found out how to report it and reported it. :slight_smile:

Thank you.

(Matthieu Aubry) #6

Thanks for the report. I have reported the bug at: Warning: file_exists(): open_basedir restriction in effect. File(plugins/Morpheus/stylesheets/ieonly.css?cb=0920 · Issue #4437 · matomo-org/matomo · GitHub

could you post the solution there? thanks!

(Edoardo) #7


I modified the core/theme.php as follows:

// replace all plugin assets to the theme, if the theme overrides
this asset
// when there are name conflicts (two plugins define the same
asset name in same folder),
// we shall rename so there is no more conflict.
$defaultThemePath = “plugins/” . $pathPluginName;
$newThemePath = “plugins/” . $this->themeName;
$overridingAsset = str_replace($defaultThemePath, $newThemePath,

     // Strip trailing querystring, if any
     $fileToCheck = $overridingAsset;
     $posQMInFileToCheck = strpos($fileToCheck, '?');
     if( $posQMInFileToCheck !== 0) {
         $fileToCheck = substr($fileToCheck, 0, $posQMInFileToCheck);

     if(file_exists($fileToCheck)) {
         return str_replace($pathAsset, $overridingAsset, $source);
     return $source;


Note that I filed 4438 before reading that you filed 4437.
4438 has the same code in the bug report.

Thank you.