PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Authentication » LiveUser_Admin » Bug #8350

LiveUser_Admin::addUser() and auto_increment

Details

Submitted2006-08-03 04:10 UTC
Fromanderson at php dot net
Assignedlsmith
StatusClosed
PackageLiveUser_Admin
PHP Version5.1.4
OSWindows XP SP2
Roadmaps(Not assigned)

Comments

[2006-08-03 04:10 UTC] anderson at php dot net

Description:
------------
I've generated my table schema using the install.php file supplied with the force_seq option turned off both on authContainer and permContainer. All managed by MDB2.

This setup generated tables in my MySQL 5.0.22 with auto_increment IDs.

I went on to add a user using an instance of the LiveUser_Admin class, method addUser.

Test script:
---------------
// $input comes from a QuickForm
$input = $form->exportValues(array('handle', 'name', 'passwd', 'is_active', 'perm_type'));
// try to add user with auto_incerement on (MySQL 5.0.22)
$addUser = $GLOBALS['LUA']->addUser($input);

Actual result:
--------------
$LUA->getErrors() returns a MySQL message saying:
Out of range value adjusted for column 'auth_user_id' at row 1

Problem is that the value supplied by LiveUser for auth_user_id is a NULL value quoted, like this: 'NULL'.

MySQL doesn't like that syntax. silvano on irc.efnet.net/#pear located the problem:

file: PEAR/LiveUser/Admin/Storage/MDB2.php
line: 382

This is a call to a method on:

file: PEAR/MDB2/Extended.php
line: 623

The calling method on MDB2.php/382 uses the default parameter $quota = true provided by the Extended.php method, wich causes the NULL value to be quoted chaining reacting up to MySQL 5.0.22.

One solution is to set the $quota parameter to false on MDB2.php, another might be add parameter in addUser or maybe a MDB2 extra configuration on cofig.php