Skip to content

Can the content filter regex backtracks be optimized? #10

@deltafactory

Description

@deltafactory

I have an edge-case scenario but wanted to suggest an improvement because it "could" affect users some day.

I am applying the content filter as an output buffer so that I can also convert non-https links outside of the post content. When applied to a 518K JSON payload, the preg_replace_callback() function fails. I could likely address this by modifying the pcre backtrack/recursion limits on my server.

Your users may trigger a similar edge case only if they have a large post_content field - unlikely, but remotely possible and a nasty gremlin to detect as there are no errors to explain the missing output.

I would submit a patch if/when I raise my regex game.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions