Home » Authentication » Auth_HTTP » Bug #2547
Global variables
Details
| Submitted | 2004-10-16 20:06 UTC |
|---|---|
| From | ward dot cloet at skynet dot be |
| Assigned | hirokawa |
| Status | Closed |
| Package | Auth_HTTP |
| PHP Version | 5.0.2 |
| OS | Windows XP |
| Roadmaps | (Not assigned) |
Comments
[2004-10-16 20:06 UTC] ward dot cloet at skynet dot be
Description:
------------
Error on global var when running using the package.
My solution is included in the 'Actual result'. I don't know if it is the good way of working, hence the report. I'm sure I've got the latest version of the package (pear upgrade tells me it is v2.0, although latest version is 2.1.3rc1. Can this be the cause?
Reproduce code:
---------------
<?php
//echo $global_var;
// example of Auth_HTTP basic implementation
require_once("Auth/HTTP.php");
// setting the database connection options
$AuthOptions = array(
'dsn'=>"mysql://dbUser:DBpassword@localhost/dbase",
'table'=>"auth", // your table name
'usernamecol'=>"username", // the table username column
'passwordcol'=>"password", // the table password column
'cryptType'=>"none", // password encryption type in your db
);
$a = new Auth_HTTP("DB", $AuthOptions);
$a->setRealm('yourrealm'); // realm name
$a->setCancelText('<h2>Error 401</h2>'); // error message if authentication fails
$a->start(); // starting the authentication process
if($a->getAuth()) // checking for autenticated user
{
echo "Hello $a->username welcome to my secret page";
};
?>
Expected result:
----------------
authentication
Actual result:
--------------
Fatal error: Call to undefined method Auth_HTTP::_importGlobalVariable() in E:\PHP5\PEAR\Auth\HTTP.php on line 79
My Solution (don't know if it is a good one:
// edit by ECE 16/10/2004 - _importGlobalVariable function has been replaced by
// direct call to global variables
// original line:
//$server = &$this->_importGlobalVariable("server");
// new line:
$server = $_SERVER;