PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » Auth » Bug #6101

Passing a custom storage object causes error

Details

Submitted2005-11-29 02:02 UTC
Frommike at mikebrittain dot com
Assignedaashley
StatusClosed
PackageAuth
PHP Version5.0.4
OSLinux
Roadmaps(Not assigned)

Comments

[2005-11-29 02:02 UTC] mike at mikebrittain dot com

Description:
------------
The end-user documentation for storage drivers suggests that if you have a custom storage object, you can pass that as the first parameter to Auth (requiring no other parameters):

<?php
include_once 'CustomAuthContainer.php';
include_once 'Auth/Auth.php';
$auth_container = new CustomAuthContainer($params);
$myauth = new Auth($auth_container);
$myauth->start();
?>

However, if you leave out the second parameter (an array), the constructor fails, giving the error:

Uninitialized string offset: 0 in /home/mbrittain/pear/lib/Auth.php on line 179

The code in Auth.php that is related to line 179 looks like this:

if (!empty($options['sessionName'])) {
$this->_sessionName = $options['sessionName'];
unset($options['sessionName']);
}

Seems that validation for the $options parameter should take into account whether or not the parameter is an array, before attempting to access an index.

[2006-02-21 04:58 UTC] aashley at php dot net

This bug has been fixed in CVS.

If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).

If this was a problem with the pear.php.net website, the change should be live shortly.

Otherwise, the fix will appear in the package's next release.

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