Skip to content

[Bug]: Issue with this commit 91ae7aadaa77e3553c1056d2582eec5b4aebc739 performing large query #3846

@Strentz-Paul

Description

@Strentz-Paul

Bug report

When executing large SQL queries with a high number of named parameters (e.g. a
Doctrine IN (...) clause with hundreds of values), the useQuestionMarkPlaceholders()
method in PDOIntegration.php triggers a fatal error due to catastrophic backtracking
in its PCRE regex.

Steps to reproduce

  1. Execute a SQL query with a large number of named parameters, for example:
    SELECT * FROM products WHERE id IN (:id_0, :id_1, ..., :id_500)
  2. Observe a fatal error after 30 seconds

Error

Fatal error: Maximum execution time of 30 seconds exceeded in
/opt/datadog/dd-library/1.19.0/dd-trace-sources/src/DDTrace/Integrations/PDO/PDOIntegration.php on line 363

PHP version

7.3.31

Tracer or profiler version

1.19.0

Installed extensions

No response

Output of phpinfo()

No response

Upgrading from

1.16.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions