History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: ZF-205
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Michal Minicki
Reporter: Michal Minicki
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Zend_Controller_RewriteRouter not working with RewriteRule defined directly in an Apache config

Created: 07/Jul/06 07:35 AM   Updated: 05/Jul/07 02:44 PM
Component/s: None
Affects Version/s: 0.1.5
Fix Version/s: 0.1.5

Time Tracking:
Not Specified

External References:
Re: [fw-general] RewriteRouter problems (Confluence: Zend Framework List Archive: FW-GENERAL)
Returnpath: <fwgeneralreturn4268zf.general=runbox.com@lists.zend.com> Received: (qmail 17280 invoked by uid 100); 7 Jul 2006 15:07:12 0000 MessageID: <33530365.1152291009863.JavaMail.root@framework.zend.com> Date: Fri, 7 Jul 2006 08:07:11 0700 (PDT) F...
Re: [fw-general] RewriteRouter problems (Confluence: Zend Framework List Archive: FW-GENERAL)
Returnpath: <fwgeneralreturn4266zf.general=runbox.com@lists.zend.com> Received: (qmail 9261 invoked by uid 100); 7 Jul 2006 14:05:33 0000 MessageID: <29214564.1152291008235.JavaMail.root@framework.zend.com> Date: Fri, 07 Jul 2006 16:05:33 0200 From: M...

Resolution Date: 07/Jul/06 04:08 PM


 Description  « Hide
When the RewriteRule is defined in Apache config instead of a .htaccess file, $_SERVER['SCRIPT_NAME'] doesn't contain a filename and is equal to $_SERVER['REQUEST_URI']. I'm not sure if it is a bug in PHP/Apache tandem or some very weird feature I wasn't aware of.

Reported by two people.

By Jörg Sandkuhle:

if i use the new RewriteRouter, i get an error

Warning: strpos() [function.strpos <http://develop/function.strpos>]:
Empty delimiter. in**
C:\apache\xampp\htdocs\develop\libs\zend\incubator\library\Zend\Controller\RewriteRouter.php
on line 67

Thats because if i use the url www.example.com, the
$_SERVER['SCRIPT_NAME'] is "/",
the basename from "/" is empty.

$base = $_SERVER['SCRIPT_NAME'];

if (strpos($_SERVER['REQUEST_URI'], basename($base)) === false)

Unknown macro: { $base = rtrim(dirname($base), '/'); }

$this->_rewriteBase = $base;

If i type www.example.com/test everything is ok.

And by Matthew Ratzloff:

With the pre-rewriteBase RewriteRouter everything worked great for me, but
now that the rewriteBase stuff has been added I can't get it to work at
all. This is using a version of the router I checked out just a couple
hours ago.

Here are some specific errors I'm getting (lines refer to RewriteRouter):

getCurrentRoute() on the root index throws this:

Fatal error: Uncaught exception 'Zend_Controller_Router_Exception' with
message 'Current route is not defined' [...] on line 84

The index page gives a warning:

Warning: strpos() [function.strpos]: Empty delimiter. [...] on line 63

And all routes (/controller/action, controller/action/key/value, special
routes defined with addRoute()) default to noRoute. The traditional
routes work just fine with the original router.

And I'm not sure if this is how rewriteBase is supposed to work, but
getRewriteBase() returns the full web path (minus domain). Manually
setting the rewriteBase with setRewriteBase() makes no difference.



 All   Comments   Work Log   Change History   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Jayson Minard - 11/Jul/06 11:54 AM
0.1.5 released