Skip to content


Subversion checkout URL

You can clone with
Download ZIP


In Theme.php, file_exists() triggers open_basedir restrictions in Windows PHP if contaning querystring #4438

EPinci opened this Issue · 1 comment

2 participants


Looks like, in Windows PHP 5.5.7,
if the filename passed to file_exists() contains a querystring
the open_basedir restrictions bogusly triggered.
Dunno if relevant, i have two paths in my open_basedir directive.

I fixed the Core\Theme.php file 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, $pathAsset);

    // 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;

Thank you.


In 1782c1e: Remove query string before checking if file exists, for windows + open_basedir. fixes #4438

@EPinci EPinci added this to the 2.0.3 - Piwik 2.0.3 milestone
@mattab mattab was assigned by EPinci
@sabl0r sabl0r referenced this issue from a commit in sabl0r/piwik
@mattab mattab Remove query string before checking if file exists, for windows + ope…
…n_basedir. fixes #4438
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.