contao/test — Issue #1221: Bug in User.php - importUser HOOK breaks Model::save();
Author: importer
Created: 2011-11-29 07:32:45+00:00
State: open
Labels: Defect, framework

in libraries/User.php:
ab Zeile 84 neu:

```
/**
* User import object
* @var object
*/
protected $objImport;
```

ab Zeile 178:

```
// HOOK: pass credentials to callback functions
if (isset($GLOBALS['TL_HOOKS']['importUser']) && is_array($GLOBALS['TL_HOOKS']['importUser']))
{
foreach ($GLOBALS['TL_HOOKS']['importUser'] as $callback)
{
$this->import($callback[0]);
$blnLoaded = $this->$callback[0]->$callback[1]($this->Input->post('username'), $this->Input->post('password'), $this->strTable);
// Load successfull
if ($blnLoaded === true)
{
break;
}
}
}
```

geaendert in:

```
// HOOK: pass credentials to callback functions
if (isset($GLOBALS['TL_HOOKS']['importUser']) && is_array($GLOBALS['TL_HOOKS']['importUser']))
{
foreach ($GLOBALS['TL_HOOKS']['importUser'] as $callback)
{
$this->import($callback[0], 'objImport', true);
$blnLoaded = $this->objImport->$callback[1]($this->Input->post('username'), $this->Input->post('password'), $this->strTable);
// Load successfull
if ($blnLoaded === true)
{
break;
}
}
}
```

Ansonsten versucht Model::save anschliessend die zuletzt verwendete Importer Klasse in die DB zu speichern.

Related issues: #1222

--- _Originally created by xtra on November 30th, 2009, at 05:33pm (ID 1221)_