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

InWhere EOF exception #10676

Closed
traikodinev opened this issue Jul 16, 2015 · 5 comments
Closed

InWhere EOF exception #10676

traikodinev opened this issue Jul 16, 2015 · 5 comments
Labels
not a bug Reported issue is not a bug

Comments

@traikodinev
Copy link

$users = \Models\Users::query()
    ->inWhere("id", array())
    ->execute();

When inWhere is given an empty array, it crashes with the following exception:

Phalcon\Mvc\Model\Exception: Syntax error, unexpected EOF

At the very least, the error could make more sense :)

@andresgutierrez
Copy link
Contributor

"id" is not an expression that can be evaluated (it requires an operator) so it encounters the EOF which is unexpected for the parser, so a syntax error is thrown, totally make sense

@traikodinev
Copy link
Author

But it's not a syntax error.. Unexpected EOF has a completely different meaning.
It might make sense when you know how it works, but the exception is totally wrong.

@andresgutierrez andresgutierrez added the not a bug Reported issue is not a bug label Jul 16, 2015
@andrew-demb
Copy link
Contributor

andrew-demb commented Jul 3, 2016

I'm sorry for up closed issue, but I have a question.
Why in \Phalcon\Mvc\Model\Criteria::inWhere() (

for value in values {
) we don't check for empty array values and modify condition like the \Phalcon\Mvc\Model\Query\Builder::inWhere() (
if !count(values) {
)? I think it would have a bit more logic and resolve this issue.
Phalcon 2.1.x

@sergeyklay
Copy link
Contributor

@andrew-demb Could you please create separated issue with script to reproduce

@sergeyklay
Copy link
Contributor

Fixed in the 3.0.x branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not a bug Reported issue is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants