symfony/symfony-docs — pull request #4444 by MightyBranch (2014-11-11 15:36:56+00:00)
Title: fix elseif statement

| Q | A
| ------------- | ---
| Doc fix? | yes
| New docs? | no
| Applies to | all
| Fixed tickets | --

In this example of the book, the elseif block always evaluates to FALSE since $_SERVER['REQUEST_URI'] includes the query string, therefore if $uri equals to '/index.php/show' then $_GET['id'] is never set, and the list_action() is never executed.

Here I propose a fix by cleaning the query string from the URI before assigning it to $uri, using the built-in function parse_url().