Commit 55eaa165 authored by Thomas Müller's avatar Thomas Müller
Browse files

Merge pull request #16119 from owncloud/fix-16056

[HHVM] Throw RunTimeException from OC\AppFramework\App::buildAppNamespace()
parents cd4b9258 e418ced6
......@@ -49,19 +49,22 @@ class App {
*/
public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
// first try to parse the app's appinfo/info.xml <namespace> tag
$filePath = OC_App::getAppPath($appId) . '/appinfo/info.xml';
$loadEntities = libxml_disable_entity_loader(false);
$xml = @simplexml_load_file($filePath);
libxml_disable_entity_loader($loadEntities);
if ($xml) {
$result = $xml->xpath('/info/namespace');
if ($result && count($result) > 0) {
// take first namespace result
return $topNamespace . trim((string) $result[0]);
$appPath = OC_App::getAppPath($appId);
if ($appPath !== false) {
$filePath = "$appPath/appinfo/info.xml";
if (is_file($filePath)) {
$loadEntities = libxml_disable_entity_loader(false);
$xml = @simplexml_load_file($filePath);
libxml_disable_entity_loader($loadEntities);
if ($xml) {
$result = $xml->xpath('/info/namespace');
if ($result && count($result) > 0) {
// take first namespace result
return $topNamespace . trim((string) $result[0]);
}
}
}
}
// if the tag is not found, fall back to uppercasing the first letter
return $topNamespace . ucfirst($appId);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment