auraphp / Aura.SqlQuery

Independent query builders for MySQL, PostgreSQL, SQLite, and Microsoft SQL Server.
MIT License
452 stars 86 forks source link

[BUG] Fix bad use of strripos #207

Closed harikt closed 1 year ago

harikt commented 1 year ago

It is 100% valid for strripos to return 0 we want quotes in that case for the AS blah NEVER EVER if a strripos, always explicitly check for false!!

This was breaking jsonb text returns with mixed case aliases

Select "pt"."name"->>'en_US' AS "myDescription" from mytable pt is what we want to end up with The replaceNamesAndAliasIn was getting ' AS myDescription' and not properly escaping it because the strripos was returning 0