Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block cloning not working for fairly big file #1698

Open
Herz3h opened this issue Aug 21, 2019 · 0 comments
Open

Block cloning not working for fairly big file #1698

Herz3h opened this issue Aug 21, 2019 · 0 comments

Comments

@Herz3h
Copy link

Herz3h commented Aug 21, 2019

Describe the Bug

With a docx file of roughly 5 pages (has full text on each page, with different styles)

Steps to Reproduce

Clone any block of a fairly big file (mine has 5 pages)

Expected Behavior

Blocks to be cloned

Current Behavior

Does not clone any block

Context

pcre.backtrack_limit | "1000000"
pcre.recursion_limit | "100000"
pcre.jit | "1"

  • PHP Version: 7.12
  • PHPWord Version: 0.13.*

The regex used (https://github.com/PHPOffice/PHPWord/blob/develop/src/PhpWord/TemplateProcessor.php#L739) has catastrophic backtracking when I try it on regex101.com and the only way to get this to work is to increase limit as following in my case:

ini_set("pcre.backtrack_limit", "23001337");
ini_set("pcre.recursion_limit", "23001337");

I tried optimizing the regex, but couldn't achieve much. I'm just reporting issue here for information since in my case I just increase the backtracking limit. But it may be something good to optimize ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant