Skip to content

500 Error when PREG Backtrack Limit Exhausted #993

@christianc1

Description

@christianc1

PHP versions 5.2.x have a default value of 100000 on pcre.backtrack_limit. We stumbled on the issue in 0.7-beta with the work supporting amp-bind.

We are using amp-iframe as a container for a table with a lot of rows and some javascript to help filter that table. We're injecting the iframe source through the srcdoc attribute. The regex matching tag attributes eventually will hit backtrack limit, fail with a PREG_BACKTRACK_LIMIT_ERROR silently, and AMP_Dom_Utils::convert_amp_bind_attributes will return null.

Further along the stack, this null value will be fed to DOMDocument which will cause a fatal error.
I'm opening up a PR shortly with some failing tests. I've made an attempt at modifying the regex, but I can't get all the tests to pass with my changes so I'm opening up this issue to the broader community.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions