diff --git a/src/QueryReflection/QueryReflection.php b/src/QueryReflection/QueryReflection.php index 5fa6caad..f09baa9a 100644 --- a/src/QueryReflection/QueryReflection.php +++ b/src/QueryReflection/QueryReflection.php @@ -42,9 +42,9 @@ final class QueryReflection // see https://github.com/php/php-src/blob/01b3fc03c30c6cb85038250bb5640be3a09c6a32/ext/pdo/pdo_sql_parser.re#L48 private const NAMED_PATTERN = ':[a-zA-Z0-9_]+'; - private const REGEX_UNNAMED_PLACEHOLDER = '{(["\'])((?:(?!\1).)*\1)|(' . self::UNNAMED_PATTERN . ')}'; + private const REGEX_UNNAMED_PLACEHOLDER = '{(["\'])((?:(?!\1)(?s:.))*\1)|(' . self::UNNAMED_PATTERN . ')}'; - private const REGEX_NAMED_PLACEHOLDER = '{(["\'])((?:(?!\1).)*\1)|(' . self::NAMED_PATTERN . ')}'; + private const REGEX_NAMED_PLACEHOLDER = '{(["\'])((?:(?!\1)(?s:.))*\1)|(' . self::NAMED_PATTERN . ')}'; /** * @var QueryReflector|null diff --git a/tests/rules/data/pdo-stmt-execute-error.php b/tests/rules/data/pdo-stmt-execute-error.php index 40d08b92..ec54910c 100644 --- a/tests/rules/data/pdo-stmt-execute-error.php +++ b/tests/rules/data/pdo-stmt-execute-error.php @@ -136,4 +136,14 @@ public function supportNestedQuotes(PDO $pdo) ); $stmt->execute(['value' => 'bar']); } + + public function bug657MultilineString(PDO $pdo) + { + $stmt = $pdo->prepare(<<execute(['value']); + } }