Skip to content

Commit 6f71a3b

Browse files
auroraeosroseharikt
authored andcommitted
[BUG] Fix bad use of strripos
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
1 parent 265abd3 commit 6f71a3b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Common/Quoter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ protected function replaceNamesAndAliasIn($val)
206206
{
207207
$quoted = $this->replaceNamesIn($val);
208208
$pos = strripos($quoted, ' AS ');
209-
if ($pos) {
209+
if ($pos !== false) {
210210
$alias = $this->replaceName(substr($quoted, $pos + 4));
211211
$quoted = substr($quoted, 0, $pos) . " AS $alias";
212212
}

0 commit comments

Comments
 (0)