We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

findFirst() broken with long string

I've got a standard model I'm running findFirst(). When I pass a really weird string:

-102009260052016-818051805180518061806-071808-101810-111811-121812181218121812181218121812-131813-2018051805--710------------------------------18---------------------------------------------------------------234234--------------------------------------13---------------------------------------------------18051805111805--------------------217---------------22---1122--23-----------------18----2-2-------------1------251805--------------------------------------------------1805-1805-6-1805-------1805-----------------------------------------15----------------------160000---301805--------------------------------18061806---------------------------------------------------1806-1806--800800----------------1806-07-----------1234567------1806---------18051806-1805261807------480000300001500015000070000100001000001807--------22---------1805-------------27--------18081809-1808-101809----1809------18091805-1809----------1808-1809-----17123--1-2-3---23--2-2---2412-327-379--1809-----1809-1805-----1809-10------------------------

as the sole argument, I get an exception:

Phalcon\Mvc\Model\Exception: Syntax error, unexpected token LIMIT, near to ' :APL0:', when parsing: SELECT [Model\Student].* FROM [Model\Student] WHERE -1020[string trimmed]----------- LIMIT :APL0: (1089)

As far as I know, the query should resolve to a comparison against the primary key, but it appears the argument is being treated as the entire condition. Is this a bug in Phalcon or me?

Will be able to test soon. Perhaps you can try with findFirstByColumnName() meanwhile?

I did - same behaviour. Trimming the string to 13 characters fixed the problem. 13 is a length chosen for internal reasons - I don't know what the actual cutoff would be.



85.5k

find(["conditions" => "my_col = "?0" , bind => [0 => "that creepy string"]]) ?

find(["conditions" => "my_col = "?0" , bind => [0 => "that creepy string"]]) ?

Same result.

why not mysql is good Java. Java decreased in popularity by about 6,000 job postings in 2018 compared to 2017, but is still extremely well-established. ... Python. Python grew in popularity by about 5,000 job postings over 2017. ... JavaScript. ... C++ ... C# ... PHP. ... Perl.