Skip to content

[ExpressionLanguage] throw an SyntaxError instead of an undefined index notice #25323

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

Merged

Conversation

Simperfit
Copy link
Contributor

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #25214
License MIT
Doc PR none

I think this is a bug when the components throws a notice instead of an exception.

it's too early and too dark to see something outside so here is my couch :
img_2915-2

@nicolas-grekas nicolas-grekas changed the base branch from master to 2.7 December 5, 2017 06:20
@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Dec 5, 2017
@Simperfit Simperfit force-pushed the bugfix/throw-an-exception-instead-of-a-notice branch from 99b4086 to 8822114 Compare December 5, 2017 06:47
Copy link
Contributor

@sroze sroze left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@@ -56,6 +56,10 @@ public function next()

++$this->position;

if (!isset($this->tokens[$this->position])) {
throw new SyntaxError('Unexpected end of expression', $this->current->cursor, $this->expression);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we move the safe guard that was already there? I don't see how the first exception could ever be thrown. It looks to me like this was just mistakenly placed before the pointer is advanced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Simperfit Simperfit force-pushed the bugfix/throw-an-exception-instead-of-a-notice branch from 8822114 to 78abc89 Compare December 7, 2017 09:26
@fabpot
Copy link
Member

fabpot commented Dec 7, 2017

Thank you @Simperfit.

@fabpot fabpot merged commit 78abc89 into symfony:2.7 Dec 7, 2017
fabpot added a commit that referenced this pull request Dec 7, 2017
…defined index notice (Simperfit)

This PR was merged into the 2.7 branch.

Discussion
----------

[ExpressionLanguage] throw an SyntaxError instead of an undefined index notice

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #25214
| License       | MIT
| Doc PR        | none

I think this is a bug when the components throws a notice instead of an exception.

it's too early and too dark to see something outside so here is my couch :
![img_2915-2](https://user-images.githubusercontent.com/3451634/33592448-6b514050-d98b-11e7-8086-bc6e6b6e6e82.jpg)

Commits
-------

78abc89 [ExpressionLanguage] throw an SyntaxError instead of letting a undefined index notice
This was referenced Dec 15, 2017
This was referenced Jan 5, 2018
@Simperfit Simperfit deleted the bugfix/throw-an-exception-instead-of-a-notice branch August 6, 2018 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants