Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing default/fallback url when no referrer is set.
Fixes #1761
- Loading branch information
Fixes #1761
182a89b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldnt referer() already fallback to '/' when no referer can be read from header, i think $default only needs to be set when you want another default url then '/'
so shouldn't we focus on why referer() without $default doesnt return '/' for ticket #1761
182a89b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current default for controller::referer() is null, but it does look like there might be a way in CakeRequest to get an empty value out of CakeRequest::referer(). The tests seem to indicate otherwise though. I think you're right though that there might be a problem somewhere else.
182a89b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The $default is null, but the default return is '/'.
https://github.com/cakephp/cakephp/blob/2.0/lib/Cake/Controller/Controller.php#L884
Does that mean if there is no referer and no $default it would return '/'?
Even CakeRequest::referer() returns '/' by default.
182a89b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the default returned '/' when $default = null, is what i meant, hence i said focus on why this occurs for ticket #1761