Skip to content

Routing failed with htaccess #4667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arcanis opened this issue Jun 26, 2012 · 2 comments
Closed

Routing failed with htaccess #4667

arcanis opened this issue Jun 26, 2012 · 2 comments

Comments

@arcanis
Copy link

arcanis commented Jun 26, 2012

Hi,

Here is my htaccess. When I try to access to the route /Goog/polls, it says No route found for "GET g/polls".
I think the problem come from a substr, because the only significant difference in $_ENV is the variable REQUEST_URI :

fail : string(23) "/app_dev.php/Goog/polls"
ok   : string(27) "/web/app_dev.php/Goog/polls"
                                   ^-- the '/' and the 'g' matches

htaccess

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /web/$1 [L]

edit It probably comes from Symfony\Component\HttpFoundation\Request::preparePathInfo or something like that. That's strange, because my PATH_INFO env var is correctly set. Why does it want to use REQUEST_URI instead ?

@fabpot
Copy link
Member

fabpot commented Jun 26, 2012

Can you ask your questions on the Symfony mailing-list? Thanks.

@fabpot fabpot closed this as completed Jun 26, 2012
@arcanis
Copy link
Author

arcanis commented Jul 3, 2012

Done. However, I have not be able to find a solution to this issue (I've noticed that my solution does not work in other environments).

I really think that it could be nice to fix the bug (because it's a bug, don't you think ? Do you think that this four-letters-truncating (related to the four letters in "/web") is a correct behavior when we could have a correct routing by using PATHINFO ?). Even if it's not advised to have such redirect in a production environment, I really don't think why it shouldn't work in a development one.

Thanks,

nicolas-grekas added a commit that referenced this issue Sep 28, 2017
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] Reference tagged services in config

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12269
| License       | MIT
| Doc PR        | symfony/symfony-docs#8404

This is a proof of concept to reference a sequence of tagged services.

The problem bugs me for some time, and at first i thought the solution was to have some super generic compiler pass. If it could replace a lot of compilers in core.. perhaps worth it, but eventually each tag comes with it's own logic, including how to deal with tag attributes.

However, writing the passes over and over again becomes tedious for the most basic usecase. So given the recent developments, this idea came to mind.

```yml
services:
    a:
        class: stdClass
        properties: { a: true }
        tags: [foo]

    b:
        class: stdClass
        properties: { b: true }
        tags: [foo]

    c:
        class: stdClass
        properties:
            #stds: !tagged_services foo (see #22198)
            stds: !tagged_services
                foo
```

```
dump(iterator_to_array($this->get('c')->stds));
```

```
array:2 [▼
  0 => {#5052 ▼
    +"a": true
  }
  1 => {#4667 ▼
    +"b": true
  }
]
```

Given the _basic_ example at https://symfony.com/doc/current/service_container/tags.html, this could replace that.

Any thoughts?

Commits
-------

979e58f [DI] Reference tagged services in config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants