views:

270

answers:

2

Howdy,

When calling the following type of url in a controller's init method I get two different results on two different servers:

http://address.com/index/action/?start=2009-04-18&end=2009-04-21

Calling

echo $_GET['start'];

Gives me 2009-04-18 on one server and nothing at all on the other server.

However, and this is the strange part, adding

exit();

after that echo statement causes 2009-04-18 to display as expected on both servers.

FYI dumping the request params shows they are available on the one server but not on the other... unless you call exit();

What in the world could be causing this? I realize this isn't the way to structure URLs in ZF but it is the way it is being done in this particular project. Maybe a custom route of some sort would help? STill doesn't explain the exit(); bit causing the $_GET variable to display.

EDIT: In order to get around this for now I wrote a custom route, however the ? in the url messes things up. By including it it appears that the GET variable is forced and overrides my custom route. Leaving it out, everything works fine in the route I created but I don't have the option to remove that ?. Anyone know how to make the custom route take precedence over the GET variables being populated when that ? is in there?

+1  A: 

My guess is the $_GET['start'] is actually working on both servers, the problem is the one that shows nothing is having a problem AFTER this statement, but the output from the echo is still in the output buffer. If you do a flush() after the echo, you should be able to see the output, then whatever crashing afterwords will still crash but you will see the date.

I'm not sure what you're doing with the routing(not enough code to see), but your query string(everything after the ?) is totally different from your routes. If you're going to use routing, you'll want to enable mod_rewrite by using the provided .htaccess file on the ZF Quickstart page.

I think you'll want to make your own custom Router(not just a Route), and then use the $_GET parameters to route to the controller you want, along with the parameters it needs. The default Router doesn't do complicated things with the QueryString, at least not the last time I checked.

Kekoa
+1  A: 

Check your .htaccess file on the broken server. http://framework.zend.com/manual/en/zend.controller.router.html

Steve