|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-08-12 08:31 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 15:00:01 2025 UTC |
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];