Skip to content

[Cache, YAML, Doctrine?] misleading / unclear error message #8485

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
rogerwalt opened this issue Jul 13, 2013 · 2 comments
Closed

[Cache, YAML, Doctrine?] misleading / unclear error message #8485

rogerwalt opened this issue Jul 13, 2013 · 2 comments

Comments

@rogerwalt
Copy link

Symfony version 2.3.1

FatalErrorException: Parse: syntax error, unexpected '$ConnectionService' (T_VARIABLE), expecting '(' in /var/www/Sdotplus/source/app/cache/dev/appDevDebugProjectContainer.php line 652

This occurs when you have a $ in the doctrine configuration, e.g. like this:

doctrine:
    dbal:
        default_connection: default
        connections:
            k$:
                ...

I think its not necessarily a bug, but a very misleading error message. I would expect the YAMLLoader to catch this situation, no?

@cordoval
Copy link
Contributor

$ probably shouldn't be used, now the yaml loader could have a check on keys if they compraise the $ character or other and fire an exception accordingly

@GromNaN
Copy link
Member

GromNaN commented Jul 14, 2013

  1. DI component should validate service names to check that they contains only valid characters to generate the method name OR remove them in the PhpDumper.
  2. As said @cordoval, the DoctrineBundle should also validate the connection name in the Configuration class.

fabpot added a commit that referenced this issue Jul 20, 2013
This PR was merged into the 2.2 branch.

Discussion
----------

[DependencyInjection] Add exception for service name not dumpable in PHP

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8485 #8030
| License       | MIT
| Doc PR        | n/a

Throws an exception when the DIC is dumped to PHP, before generating invalid PHP.
The regex comes from the PHP doc: http://www.php.net/manual/en/language.oop5.basic.php

Commits
-------

242b318 [DependencyInjection] Add exception for service name not dumpable in PHP
fabpot added a commit that referenced this issue Jul 20, 2013
This PR was merged into the 2.3 branch.

Discussion
----------

[DependencyInjection][2.3] Add exception for service name not dumpable in PHP

Same as #8494 for branch 2.3 since the DI component has been refactored (bb797ee, f1c2ab7)

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #8485 #8030
| License       | MIT
| Doc PR        | n/a

Throws an exception when the DIC is dumped to PHP, before generating invalid PHP.
The regex comes from the PHP doc: http://www.php.net/manual/en/language.oop5.basic.php

Commits
-------

9ac3556 [DependencyInjection] Add exception for service name not dumpable in PHP
@fabpot fabpot closed this as completed Jul 20, 2013
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

4 participants