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

SQL/Parser.php: ARRAY[:param] hits but ARRAY [:param] misses #6247

Open
millawell opened this issue Dec 21, 2023 · 0 comments
Open

SQL/Parser.php: ARRAY[:param] hits but ARRAY [:param] misses #6247

millawell opened this issue Dec 21, 2023 · 0 comments

Comments

@millawell
Copy link

millawell commented Dec 21, 2023

Bug Report

Q A
Version ^3.4.0

Summary

A whitespace between ARRAY and the square bracket [ will result in the parser missing the replacement of the :parameter var with ?.

How to reproduce

$QUERY = <<<SQL
        with config as (
            select ARRAY [:parameter] as parameter
        )
        SQL;

does not work but

$QUERY = <<<SQL
        with config as (
            select ARRAY[:parameter] as parameter
        )
        SQL;

works

In Connection.php:1089 ([$sql, $params, $types] = $this->expandArrayParameters($sql, $params, $types);),
the ARRAY [:parameter] should be replaced with ARRAY[?].

I guess it comes down to modifying the regex in Parser.php@BRACKET_IDENTIFIER

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants