LLukaB
(Linus)
February 12, 2018, 5:05pm
#1
Hey Team,
Matomo told me to post this Message in the Forum — here we go:
WARNING: /var/www/virtual/linuslukabahun.de/htdocs/piwik/vendor/twig/twig/lib/Twig/Loader/Filesystem.php(35): Warning - realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/virtual/linuslukabahun.de/:/opt/phpswitcher/php7.0/share/pear/) - Matomo 3.3.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
Is there anything I should do right now?
Lukas
(Lukas Winkler)
February 12, 2018, 7:15pm
#2
Hi,
This seems to be the same issue as this one:
opened 09:16AM - 16 Nov 17 UTC
closed 10:09AM - 20 Mar 18 UTC
Bug
When viewing:
https://siteurl/index.php?module=CoreHome&action=index&idSite=2… 3&period=range&date=previous7&updated=1#?idSite=23&period=range&date=previous7&category=Dashboard_Dashboard&subcategory=1
I get the warning message:
```
WARNING: /var/www/siteurl/vendor/twig/twig/lib/Twig/Loader/Filesystem.php(35): Warning - realpath(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/var/www/siteurl) - Piwik 3.2.0
```
Looking at where `Twig_Loader_Filesystem` is used, the `$rootPath` parameter is not passed to the constructor, so it falls back to the current working directory (which happens to be outside of the basedir for the PHP installation).
PHP Version: 7.0.19-1
Piwik Version: 3.2.0
I can provide more information if needed.
Can you try to apply this change and check if this fixes the issue for you
https://github.com/matomo-org/matomo/compare/twigroot
diff --git a/core/Twig.php b/core/Twig.php
index c36452055b..b34b8d11bb 100755
--- a/core/Twig.php
+++ b/core/Twig.php
@@ -313,7 +313,7 @@ private function getDefaultThemeLoader()
{
$themeLoader = new Twig_Loader_Filesystem(array(
sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, \Piwik\Plugin\Manager::DEFAULT_THEME)
- ));
+ ), PIWIK_DOCUMENT_ROOT.DIRECTORY_SEPARATOR);
return $themeLoader;
}
@@ -330,7 +330,7 @@ protected function getCustomThemeLoader(Plugin $theme)
}
$themeLoader = new Twig_Loader_Filesystem(array(
sprintf("%s/plugins/%s/templates/", PIWIK_INCLUDE_PATH, $theme->getPluginName())
- ));
+ ), PIWIK_DOCUMENT_ROOT.DIRECTORY_SEPARATOR);
return $themeLoader;
}