PEAR is archived and read-only

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

Home » Authentication » Auth » Bug #2932

[doc] Introduction Example doesn't work

Details

Submitted2004-12-09 05:00 UTC
Fromsjb26 at yahoo dot com
Assignedaashley
StatusClosed
PackageAuth
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2004-12-09 05:00 UTC] sjb26 at yahoo dot com

Description:
------------
The example on the Introduction page does not work; the
example on the Constructor page works. Notice the
difference in how the dsn is passed.

Also, why does the Introduction page use $a-
>checkAuth() while the Constructor page uses $a-
>getAuth()? What is the preferred method?

Reproduce code:
---------------
// INTRODUCTION PAGE EXAMPLES
// Note the dsn being passed in the constructor--this DOES NOT work!
$dsn = "mysql://user:password@localhost/database";
$a = new Auth("DB", $dsn, "loginFunction");

// CONSTRUCTOR PAGE EXAMPLE
// Note the dsn is part of the params array now--this DOES work!
$params = array(
            "dsn" => "mysql://martin:test@localhost/auth",
            "table" => "myAuth",
            "usernamecol" => "myUserColumn",
            "passwordcol" => "myPasswordColumn"
            );

$a = new Auth("DB", $params, "myOutput");

[2005-02-01 21:55 UTC] hugo123fr at hotmail dot com

In the same idea, the field "dbFields" doesn't work. It's "db_fields".

[2005-02-08 22:02 UTC] mathieu dot bonnet at nalkym dot org

>
> [2004-12-09 05:00 UTC] sjb26 at yahoo dot com
>
> The example on the Introduction page does not work; the
> example on the Constructor page works. Notice the
> difference in how the dsn is passed.
>

It does work for me, either if I use a string, or an array to pass the DSN. Please check again (DSN, table/fields used, etc.), and give us more informations if it still fails.

In particular, the default table name is 'auth', and default fields are 'username' and 'password' (those are the values which will be used in the first example, if you don't set them afterward...)

If it's a problem on your side, please read the documentation, before submitting a bug report.

>
> [2004-12-09 05:00 UTC] sjb26 at yahoo dot com
>
> Also, why does the Introduction page use $a->checkAuth()
> while the Constructor page uses $a->getAuth()? What is
> the preferred method?
>

checkAuth() has '@access private' and getAuth() has '@access public', so you should use getAuth() (which does only call checkAuth()). The documentation should indeed be corrected accordingly.

>
> [2005-02-01 21:55 UTC] hugo123fr at hotmail dot com
>
> In the same idea, the field "dbFields" doesn't work.
> It's "db_fields".
>

Duplicate: http://pear.php.net/bugs/bug.php?id=2495 (Closed, Fixed)
Duplicate: http://pear.php.net/bugs/bug.php?id=2621 (Closed, Fixed)

[2006-02-21 05:45 UTC] aashley at php dot net

The introduction documentation has been updated for 1.3 while the constructor hasnt.

I will review the documentation once a stable 1.3 is ready. with 1.3 both examples should work.