#25054 [Ana->Csd]: AUTH getAuthData method bug
| From: | maka3d at yahoo dot com dot br | Date: | Tue, 12 Aug 2003 18:17:32 +0000 |
| Subject: | #25054 [Ana->Csd]: AUTH getAuthData method bug | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-19572@lists.php.net to get a copy of this message | ||
ID: 25054
User updated by: maka3d at yahoo dot com dot br
Reported By: maka3d at yahoo dot com dot br
-Status: Analyzed
+Status: Closed
Bug Type: PEAR related
Operating System: Irrelevant
PHP Version: Irrelevant
Assigned To: yavo
New Comment:
Works fine,
thanks!
Previous Comments:
------------------------------------------------------------------------
[2003-08-12 10:26:42] nicos@php.net
Here is the patch.
I need feedbacks please.
Index: Auth.php
===================================================================
RCS file: /repository/pear/Auth/Auth.php,v
retrieving revision 1.57
diff -u -u -r1.57 Auth.php
--- Auth.php 19 Jul 2003 18:04:20 -0000 1.57
+++ Auth.php 12 Aug 2003 15:26:03 -0000
@@ -429,7 +429,11 @@
$session = &Auth::_importGlobalVariable("session");
if (is_null($name)) {
- return $session['auth']['data'];
+ if(isset($session['auth']['data'])) {
+ return $session['auth']['data'];
+ } else {
+ return null;
+ }
}
if (isset($session['auth']['data'][$name])) {
return $session['auth']['data'][$name];
------------------------------------------------------------------------
[2003-08-12 08:31:50] maka3d at yahoo dot com dot br
Description:
------------
PEAR package Auth
the getAuthData method of Auth class, raise a Notice error if called
without a user login successfull before.
Reproduce code:
---------------
...
function getAuthData($name = null)
{
$session = &Auth::_importGlobalVariable("session");
if (is_null($name)) {
return $session['auth']['data']; // // trigger a NOTICE if the user is
not logged-in
...
// solution: return isset($session['auth']['data']) ?
$session['auth']['data'] : null;
Expected result:
----------------
expect return null
Actual result:
--------------
raise a notice
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=25054&edit=1