Welcome Guest, Not a member yet? Register   Sign In
URI class doesn’t recognize #anchors
#1

[eluser]coolfactor[/eluser]
The URI class doesn't properly recognize/handle anchors in URIs in certain situations.

Here's an illustration using a custom route from an old address, mission.html, to an anchor in CI-powered page, /page/info#mission.

Code:
$route['mission.html'] = 'page/info#mission';

Here's the URI::ruri_string() function:

Code:
function ruri_string()
{
    return '/'.implode('/', $this->rsegment_array()).'/';
}

The ruri_string() function will return "/page/info#mission/", corrupting the anchor reference. Looking at the internal URI::$rsegments array, shows segment 2 being "info#mission".

(One workaround is to precede the hash by a slash, page/info/#mission, but then segment 3 would become "#mission", which is technically incorrect.)

I propose that the URI class parse out the anchor reference to a separate variable, and reapply it as needed. Discussion?


Messages In This Thread
URI class doesn’t recognize #anchors - by El Forum - 07-27-2008, 11:29 PM
URI class doesn’t recognize #anchors - by El Forum - 07-28-2008, 12:01 AM
URI class doesn’t recognize #anchors - by El Forum - 07-28-2008, 12:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB