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 » Bug #1605

Bug in addUser in LiveUser_Admin_Auth_Container_MDB2

Details

Submitted2004-06-10 13:16 UTC
Fromsimon dot hamilton at ntlworld dot com
Assignedlsmith
StatusClosed
PackageLiveUser
PHP VersionIrrelevant
OSn/a
Roadmaps(Not assigned)

Comments

[2004-06-10 13:16 UTC] simon dot hamilton at ntlworld dot com

Description:
------------
In LiveUser_Admin_Auth_Container_MDB2 Line:150

$options['optimize'] = 'portability';
if ($function == 'singleton') {
$this->dbc =& MDB2::singleton($connectOptions['dsn'], $options);
} else {
$this->dbc =& MDB2::connect($connectOptions['dsn'], $options);
}
if (!MDB2::isError($this->dbc)) {
$this->init_ok = true;
}

The "optomize" option doesnt exist, but looking at the MDB code, I'm not really sure what to replace it with for a patch. Lukas?

[2004-06-10 15:23 UTC] simon dot hamilton at ntlworld dot com

This is really weird. Although I can find no reference to this:
$options['optimize'] = 'portability';

When I remove it, or change it to a valid setting (PORTABILITY_ALL) the app breaks...how can this be?

I've also noticed a few inconsistencies in this class relating to the recent changes in the authContainer array structure (some user_id instead of auth_user_id) and an old MDB2 $this->dbc->getValue which needs changed to ->quote().

Any suggestions on the above $options thingy would be useful.

[2004-06-10 15:28 UTC] smith at backendmedia dot com

It should be something like this:
$options['portability'] = MDB2_PORTABILITY_ALL;

[2004-06-10 15:32 UTC] simon dot hamilton at ntlworld dot com

I tried this Lukas but it still doesnt work. I even tried it with the constant value (63) but that doesn't work either.

[2004-06-10 15:36 UTC] smith at backendmedia dot com

Hmm could you do an print_r($this->dbc) .. and let me know what you get?

[2004-06-10 15:39 UTC] simon dot hamilton at ntlworld dot com

To further extend on this when I use the proper syntax ($options['portability'] = MDB2_PORTABILITY_ALL;)

I get the following errors:

Notice: Undefined index: first_name in /var/www/libs/pear/LiveUser/Admin/Auth/Container/MDB2.php on line 441

Notice: Undefined index: last_name in /var/www/libs/pear/LiveUser/Admin/Auth/Container/MDB2.php on line 441

Notice: Undefined index: email in /var/www/libs/pear/LiveUser/Admin/Auth/Container/MDB2.php on line 441

Even when I fix the MDB2 ->quote().

[2004-06-10 15:52 UTC] smith at backendmedia dot com

The order of the parameters also changed in MDB2.

MDB: getValue($type, $value)
MDB2: quote($value, $type = null)

[2004-06-10 16:22 UTC] smith at backendmedia dot com

did my commit fix your issues?

[2004-06-10 16:34 UTC] simon dot hamilton at ntlworld dot com

also in getUsers() in this file in the $query the user_id key needs changed to auth_user_id.

[2004-06-10 16:36 UTC] simon dot hamilton at ntlworld dot com

I ran your commit and I still get the same problem (I think the changes I had made where the same as yours anyway. I'll keep looking too.

[2004-06-10 16:41 UTC] simon dot hamilton at ntlworld dot com

Fixed the error:

Change Line 441 from:

$cTypes[] = $this->dbc->quote($customFields[$alias], $field_data['type']);

to $cTypes[] = $this->dbc->quote($alias, $field_data['type']);

Now to make sure what I was trying to do will work now :-)

[2004-06-10 18:45 UTC] simon dot hamilton at ntlworld dot com

OK, my last solution was not quite right, as the type should not be quoted at all I discovered.

So line 441 should be:

$cTypes[] = $field_data['type'];

I suspect this may be the case in other methods, as the custom fields were introduced, but I haven't had a look at any others yet....maybe tomorrow.

There is also a syntax problem on Line 440:

$cFields[] = $field_data['name'] . 'AS ' . $alias;

should be:

$cFields[] = $field_data['name'] . ' AS ' . $alias;
^

[2004-06-13 10:43 UTC] simon dot hamilton at ntlworld dot com

This seems fine now, thanks!

[2004-06-13 10:52 UTC] smith at backendmedia dot com

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.