summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-10-17 12:28:27 +0200
committerVincent Petry <pvince81@owncloud.com>2014-10-17 12:45:45 +0200
commit27c22f071d3f9a3dd6aa99e4e7cddb8e725a1ddf (patch)
treea8f5e1c324b9f0c63d8e3b7b13933e6768176306 /lib
parent0412f830352fe3b00a05de881535666a3530c31b (diff)
downloadnextcloud-server-27c22f071d3f9a3dd6aa99e4e7cddb8e725a1ddf.tar.gz
nextcloud-server-27c22f071d3f9a3dd6aa99e4e7cddb8e725a1ddf.zip
Encapsulate require_once to avoid name space bleedind
The script required by require_once might use variable names like $app which will conflict with the code that follows. This fix encapsulates require_once into its own function to avoid such issues.
Diffstat (limited to 'lib')
-rw-r--r--lib/private/app.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/app.php b/lib/private/app.php
index faaadef3857..a97db7b5e53 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -92,7 +92,7 @@ class OC_App {
if ($checkUpgrade and self::shouldUpgrade($app)) {
throw new \OC\NeedsUpdateException();
}
- require_once $app . '/appinfo/app.php';
+ self::requireAppFile($app);
if (self::isType($app, array('authentication'))) {
// since authentication apps affect the "is app enabled for group" check,
// the enabled apps cache needs to be cleared to make sure that the
@@ -104,6 +104,16 @@ class OC_App {
}
/**
+ * Load app.php from the given app
+ *
+ * @param string $app app name
+ */
+ private static function requireAppFile($app) {
+ // encapsulated here to avoid variable scope conflicts
+ require_once $app . '/appinfo/app.php';
+ }
+
+ /**
* check if an app is of a specific type
*
* @param string $app