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

SQLParserUtils::getPlaceholderPositions() fails if there are quoted strings containing only backslashes #2720

Merged
merged 7 commits into from
May 20, 2017

Conversation

mondrake
Copy link
Contributor

@mondrake mondrake commented May 9, 2017

Passing the following statement to SQLParserUtils::getPlaceholderPositions results in failure to identify the second placeholder condition_1.

SELECT data.age AS age, data.id AS id, data.name AS name, data.id AS id
FROM test_data data 
WHERE 
  (data.description LIKE :condition_0 ESCAPE '\\') AND 
  (data.description LIKE :condition_1 ESCAPE '\\')
ORDER BY id ASC

Apparently, ::getUnquotedStatementFragments gets confused by escapes.

Added a test to prove the bug.

@mondrake
Copy link
Contributor Author

mondrake commented May 9, 2017

Fixed my bug, but generated another one :)

@Ocramius
Copy link
Member

@mondrake excellent work, thanks! Looking good to me.

Copy link
Member

@deeky666 deeky666 left a comment

Choose a reason for hiding this comment

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

I have to admit that I barely understand those crazy regexes but the tests look reasonable to me and I simply trust you guys on this one ;)

@Ocramius Ocramius modified the milestones: 2.6, 2.5.13 May 20, 2017
@Ocramius Ocramius merged commit 7f2b2dc into doctrine:master May 20, 2017
@Ocramius
Copy link
Member

LGTM 👍

@Ocramius
Copy link
Member

@mondrake just a note - please use more self-explanatory commit messages next time :-)

Ocramius added a commit that referenced this pull request May 20, 2017
@Ocramius
Copy link
Member

Backported to 2.5 via 6cc34f1

@mondrake mondrake deleted the fix-sqlparser branch May 20, 2017 19:30
@mondrake
Copy link
Contributor Author

Sure 😄

@Ocramius Ocramius changed the title SQLParserUtils::getPlaceholderPositions fails if there are quoted strings containing only backslashes SQLParserUtils::getPlaceholderPositions() fails if there are quoted strings containing only backslashes Jul 22, 2017
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants