Skip to content

Commit

Permalink
Fix crash after successful import
Browse files Browse the repository at this point in the history
Don't overwrite completely different
$storage object with the backend driver.

Detected by using the Kolab driver:
It throws an exception if you call $driver->get('target').

Code structure cloned from nag.

Bug: 13272
Signed-off-by: Jan Schneider <jan@horde.org>
  • Loading branch information
thomasjfox authored and yunosh committed Jun 20, 2014
1 parent 7b709f6 commit ad9de97
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mnemo/data.php
Expand Up @@ -76,7 +76,7 @@
/* We have a final result set. */
if (is_array($next_step)) {
/* Create a Mnemo storage instance. */
$storage = $GLOBALS['injector']->getInstance('Mnemo_Factory_Driver')->create($storage->get('target'));
$memo_storage = $GLOBALS['injector']->getInstance('Mnemo_Factory_Driver')->create($storage->get('target'));
$max_memos = $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('max_notes');
$num_memos = Mnemo::countMemos();
foreach ($next_step as $row) {
Expand Down Expand Up @@ -111,12 +111,12 @@
$row['desc'] = array_shift($tmp);
}
try {
$result = $storage->add($row['desc'], $row['body'], $row['tags']);
$result = $memo_storage->add($row['desc'], $row['body'], $row['tags']);
} catch (Mnemo_Exception $e) {
$haveError = $e->getMessage();
break;
}
$note = $storage->get($result);
$note = $memo_storage->get($result);

/* If we have created or modified dates for the note, set them
* correctly in the history log. */
Expand Down

0 comments on commit ad9de97

Please sign in to comment.