Comments

edited

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.

This comment has been minimized.

edited

@christianc1 The row of HTML is 360 bytes. The test is failing at 10,000 iterations. That means a srcdoc that is almost 4MB (❗️) . Is it reasonable to expect this? The average AMP document is 80KB in total. As per #875 if the AMP document is more than 1MB there will be other performance problems to worry about.