PEAR is archived and read-only

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

Home » Authentication » Auth_HTTP » Bug #2380

Error when usind a DSN which is not an array

Details

Submitted2004-09-23 13:27 UTC
Fromcmoehrke at netviser dot de
Assignedhirokawa
StatusClosed
PackageAuth_HTTP
PHP Version4.3.3
OSLinux
Roadmaps(Not assigned)

Comments

[2004-09-23 13:27 UTC] cmoehrke at netviser dot de

Description:
------------
If u try to use a DSN which is not
an array, e.g. something like

$dsn = "mysql://netviser:geheim@localhost/netviser";
$my_auth = new Auth_HTTP("DB", $dsn);

it will result in an error (File HTTP.PHP, line 191).
The problem is that there is no check if $options is an array. An additional

if (is_array($options))

should fix it.
Cheers

Reproduce code:
---------------
require_once("PEAR.php");
require_once("Auth/HTTP.php");

$dsn = "mysql://netviser:geheim@localhost/netviser";
$my_auth = new Auth_HTTP("DB", $dsn);

$my_auth->setRealm('Interner Bereich');
$my_auth->setCancelText('<h2>Error</h2>');
$my_auth->start();

Actual result:
--------------
Warning: Invalid argument supplied for foreach() in /usr/share/php/Auth/HTTP.php on line 191