Skip to content
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

[Routing][Bug] File contents of class is used in exception message #17388

Closed
robinvdvleuten opened this issue Jan 15, 2016 · 0 comments
Closed
Labels

Comments

@robinvdvleuten
Copy link
Contributor

When you try to load an abstract class with annotations, the following code throws an exception;

$class = new \ReflectionClass($class);
if ($class->isAbstract()) {
    throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class));
}

But the $class variable is now a ReflectionClass instance and the complete class file contents are shown in the exception.

@xabbuh xabbuh added the Routing label Jan 15, 2016
fabpot added a commit that referenced this issue Jan 15, 2016
 #17388) (robinvdvleuten)

This PR was merged into the 2.3 branch.

Discussion
----------

[Routing] Fixed correct class name in thrown exception (fixes #17388)

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #17388
| License       | MIT
| Doc PR        |

This fixes the thrown exception. Instead of the complete file contents, the class name is used in the exception message.

Commits
-------

c847feb Fixed correct class name in thrown exception
@fabpot fabpot closed this as completed Jan 15, 2016
@fabpot fabpot mentioned this issue Feb 3, 2016
This was referenced Feb 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants