Re: Auth: loginCallback and loginFailedCallback pass a copy of auth instead of a reference
| From: | Yavor Shahpasov | Date: | Tue, 16 Mar 2004 07:49:21 +0000 |
| Subject: | Re: Auth: loginCallback and loginFailedCallback pass a copy of auth instead of a reference | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-26444@lists.php.net to get a copy of this message | ||
Fixed in CVS
Yavor
Herman Sinte Maartensdijk wrote:
The documentation of the Auth package states that the loginCallback and loginFailedCallback functions get the username and a reference to the auth-object. However in reality they get a copy and not a reference, making it impossible for the callbacks to influence the auth-class. I've attached a diff to this e-mail with a patch for this. I hop ethis can be put into the CVS Herman ------------------------------------------------------------------------ --- Auth.php.173-PR1 Thu Mar 11 10:20:44 2004 +++ Auth.php.173-PR2 Mon Mar 15 13:56:00 2004 @@ -17,7 +17,8 @@ // +----------------------------------------------------------------------+ // // $Id: Auth.php,v 1.73 2004/03/03 23:15:06 yavo Exp $ -// Added setPostUsername & setPostPassword +// PR1: Added setPostUsername & setPostPassword +// PR2: Fixed bug in loginCallback & loginFailedCallback which send a copy of auth instead of a reference // require_once 'PEAR.php'; @@ -331,7 +332,7 @@-- Yavor Shahpasov yavo@siava.orgif (!empty($this->username) && $login_ok) { $this->setAuth($this->username); if (is_callable($this->loginCallback)) { - call_user_func($this->loginCallback,$this->username, $this); + call_user_func($this->loginCallback,$this->username, &$this); } }@@ -342,7 +343,7 @@if (!empty($this->username) && !$login_ok) { $this->status = AUTH_WRONG_LOGIN; if (is_callable($this->loginFailedCallback)) { - call_user_func($this->loginFailedCallback,$this->username, $this); + call_user_func($this->loginFailedCallback,$this->username, &$this); } }