ppi / framework

The PPI Framework Engine
http://www.ppi.io
MIT License
154 stars 30 forks source link

Routes dont work when browser 'auto insert' an end slash / #50

Closed frenetic closed 12 years ago

frenetic commented 12 years ago

I'm new to PPI2 and I'm trying to implement the issue #31 as an exercise https://github.com/ppi/website/issues/31

I've declare a route, like this:

Ideas:
    pattern:  /ideas
    defaults: { _controller: "Application:Ideas:index"}

On the web browser, when I try the URL localhost/ideas everything works as expected BUT, if I add an end slash to the URL, localhost/ideas/ , I get an 404 error.

In addition, a warning is raized by PHP

Warning: strpos(): Empty delimiter in C:\try\skeletonapp\vendor\ppi\framework\PPI\App.php on line 421

For the sake of report: Win Server 2008 R2 IIS 7 PHP 5.4.4 Localhost URL is set to skeletonapp/public IIS Rewrite is on, and working fine :)

dragoonis commented 12 years ago

Hey @frenetic ,

Thanks for the bug report, this happens when you throw a 404 and then there's a problem throwing a 404.

I have changed the code to if (!empty($baseUrl) && ($pos = strpos($routeUri, $baseUrl)) !== false ) {

Now strpos() shouldn't complain that $baseUrl is empty.

Can you please clone the latest copy of the skeletonapp / framework and re-test this?

Thanks.