Skip to content
This repository was archived by the owner on Oct 29, 2021. It is now read-only.

Nested string replace causing unnecessary removals in "Paulus::parse()" #3

Open
Rican7 opened this issue Apr 17, 2013 · 0 comments
Open
Assignees

Comments

@Rican7
Copy link
Owner

Rican7 commented Apr 17, 2013

Currently, the parse() method does a nested str_replace on the built-in "{ENDPOINT}" template key.

If the base-url is simply "/", though, this removes all slashes from the endpoint. Yea, bad.

Simply changing:

$processed_string = str_replace( '{ENDPOINT}',
    str_replace( $this->config['app-meta']['base_url'], '', parse_url($this->request->uri(), PHP_URL_PATH) ),
    $processed_string
);

to this:

$processed_string = str_replace( '{ENDPOINT}',
    ltrim( parse_url($this->request->uri(), PHP_URL_PATH), $this->config['app-meta']['base_url'] ),
    $processed_string
);

should do the trick.

@ghost ghost assigned Rican7 Apr 17, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant