#5661: Controller: redirect() files using custom components
---------------------------+------------------------------------------------
Reporter: danfreak | Owner:
Type: Bug | Status: reopened
Priority: Medium | Milestone: 1.2.x.x
Component: Controller | Version: RC3
Severity: Normal | Resolution:
Keywords: | Php_version: PHP 5
Cake_version: |
---------------------------+------------------------------------------------
Changes (by danfreak):
* status: closed => reopened
* resolution: needmoreinfo =>
Comment:
See the attached test.
Basicalli
[https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controller/component.php#L142
Component::beforeRedirect()] fires the block code
{{{
if ($component->enabled === true && method_exists($component,
'beforeRedirect')) {
$resp = $component->beforeRedirect($controller,
$url, $status, $exit);
if ($resp === false) {
return false;
}
$response[] = $resp;
}
}}}
even if a Component does not have th beforeRedirect method. This is
probably right for inheritance and 'cause we must check all loaded
components.
Therefore I think that the problem is in
[https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controller/controller.php#L486
Controller::redirect()]
It works for me changing line 501 from
{{{
} elseif ($resp !== null) {
}}}
to
{{{
} elseif (!empty($resp) && $resp !== null) {
}}}
In this way $url does not get overwritten if we have an empty array
$response from Component::beforeRedirect()
--
Ticket URL: <https://trac.cakephp.org/ticket/5661#comment:4>
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
-~----------~----~----~----~------~----~------~--~---