Merge pull request #16119 from owncloud/fix-16056
[HHVM] Throw RunTimeException from OC\AppFramework\App::buildAppNamespace()
This commit is contained in:
commit
55eaa165f8
|
@ -49,19 +49,22 @@ class App {
|
||||||
*/
|
*/
|
||||||
public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
|
public static function buildAppNamespace($appId, $topNamespace='OCA\\') {
|
||||||
// first try to parse the app's appinfo/info.xml <namespace> tag
|
// first try to parse the app's appinfo/info.xml <namespace> tag
|
||||||
$filePath = OC_App::getAppPath($appId) . '/appinfo/info.xml';
|
$appPath = OC_App::getAppPath($appId);
|
||||||
$loadEntities = libxml_disable_entity_loader(false);
|
if ($appPath !== false) {
|
||||||
$xml = @simplexml_load_file($filePath);
|
$filePath = "$appPath/appinfo/info.xml";
|
||||||
libxml_disable_entity_loader($loadEntities);
|
if (is_file($filePath)) {
|
||||||
|
$loadEntities = libxml_disable_entity_loader(false);
|
||||||
if ($xml) {
|
$xml = @simplexml_load_file($filePath);
|
||||||
$result = $xml->xpath('/info/namespace');
|
libxml_disable_entity_loader($loadEntities);
|
||||||
if ($result && count($result) > 0) {
|
if ($xml) {
|
||||||
// take first namespace result
|
$result = $xml->xpath('/info/namespace');
|
||||||
return $topNamespace . trim((string) $result[0]);
|
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
|
// if the tag is not found, fall back to uppercasing the first letter
|
||||||
return $topNamespace . ucfirst($appId);
|
return $topNamespace . ucfirst($appId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue