Skip to content

Commit

Permalink
Don't crash on unknown 'migration' directories
Browse files Browse the repository at this point in the history
Fixes this error:

PHP Fatal error:  Call to a member function getName() on a non-object in
/datastore/DEVEL/framework/Core/lib/Horde/Core/Db/Migration.php on line 91

Signed-off-by: Jan Schneider <jan@horde.org>
Bug: 13013
  • Loading branch information
thomasjfox authored and yunosh committed Mar 6, 2014
1 parent aecf1e6 commit 3ca5f4c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions framework/Core/lib/Horde/Core/Db/Migration.php
Expand Up @@ -87,8 +87,14 @@ public function __construct($basedir = null, $pearconf = null)
// Loop through installed PEAR packages.
$registry = $pear->getRegistry();
foreach (glob($pear->get('data_dir') . '/*/migration') as $dir) {
$app = $registry->getPackage(
basename(dirname($dir)), 'pear.horde.org')->getName();
$package = $registry->getPackage(
basename(dirname($dir)), 'pear.horde.org');
if ($package == false) {
Horde::log("Ignoring package in directory $dir", Horde_Log::WARN);
continue;
}

$app = $package->getName();
if (!in_array($app, $this->apps)) {
$this->apps[] = $app;
$this->_lower[] = Horde_String::lower($app);
Expand Down

0 comments on commit 3ca5f4c

Please sign in to comment.