* The DB column has garbage padding as the default value, which
was intented to just be "". Since the the insert functions cast
the value to a string, inserting a user without creating a token
causes garbage to be inserted. The logic to automatically fix
empty tokens does not trigger. This fixes createNew() to set the
token and makes sure that addToDatabase() does.
Change-Id: I3529fe8afbc62bac37063217d5aa0179a4a6e169
public static function createNew( $name, $params = array() ) {
$user = new User;
$user->load();
+ $user->setToken(); // init token
if ( isset( $params['options'] ) ) {
$user->mOptions = $params['options'] + (array)$user->mOptions;
unset( $params['options'] );
*/
public function addToDatabase() {
$this->load();
+ if ( !$this->mToken ) {
+ $this->setToken(); // init token
+ }
$this->mTouched = self::newTouchedTimestamp();