#5921: Auth->redirect Undefined variable: redir line 687
-------------------------------+--------------------------------------------
Reporter: codershop | Type: Bug
Status: new | Priority: Medium
Milestone: 1.2.x.x | Component: Auth
Version: RC4 | Severity: Normal
Keywords: Auth redirect | Php_version: n/a
Cake_version: 1.2.0.7945 RC4 |
-------------------------------+--------------------------------------------
== What I did: ==
I am using revision 7949, on the branch
https://svn.cakephp.org/repo/branches/1.2.x.x[[BR]]
In AppController->beforeFilter I call:[[BR]]
{{{
$this->Auth->redirect(Router::normalize(array('action' => 'my_action')));
}}}
[[BR]]
== What I expected to happen: ==
I expected it to set the redirect for the Auth component to 'my_action'.
[[BR]]
== Why it didn't meet my expectations ==
In revision 7930 the return command was removed from line 676. This
causes the code to continue executing to line 687 where the final
return statement is issued for the redirect method. The return at
line 687 uses the redir variable. Since I was setting the redirect
value, and the redir variable was never set I get the following error:
{{{
Notice (8): Undefined variable: redir
[CORE/cake/libs/controller/components/auth.php, line 687]
}}}
[[BR]]
== Possible Fix ==
The return command should be issued at line 676 like:
{{{
if (!is_null($url)) {
return $this->Session->write('Auth.redirect',
$url);
} elseif ($this->Session->check('Auth.redirect')) {
}}}
or set $redir to the new redirect url like:
{{{
if (!is_null($url)) {
$this->Session->write('Auth.redirect', $url);
$redir = Router::normalize($url);
} elseif ($this->Session->check('Auth.redirect')) {
}}}
--
Ticket URL: <https://trac.cakephp.org/ticket/5921>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC.
Our primary goal is to provide a structured framework that enables PHP users at
all levels to rapidly develop robust web applications, without any loss to
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---