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

Template Processor document size limit ? #2217

Closed
nsasit opened this issue Apr 25, 2022 · 3 comments
Closed

Template Processor document size limit ? #2217

nsasit opened this issue Apr 25, 2022 · 3 comments

Comments

@nsasit
Copy link

nsasit commented Apr 25, 2022

Describe the Bug

I use a complex word document as template.
I use $templateProcessor->cloneBlock('device', 0, true, false, $array_devices); where array_devices is a array.
It's work fine but if I add some paragraphs to my template (only text), I does not work.
Seems to be a problem of max size of my template because if I remove some characters, it's work fine.

Steps to Reproduce

$templateProcessor->cloneBlock('device', 0, true, false, $array_devices); with my word template => does not working
If I edit my template and remove some characters (only text, not special characters, no image, no variable ...) => works

Context

Please fill in your environment information:

  • PHP Version: 8.0.17
  • PHPWord Version: 0.18.3
@matthewknill
Copy link

matthewknill commented Oct 18, 2022

@nsasit what was the fix for this? I'm having a similar issue whereby a template of >8000 words with some formatting seems to break but removing some words fixes it.

Edit: I tried changing upping the memory_limit in php.ini but it did not make a difference.

@matthewknill
Copy link

Ah bingo, the fix was to up the pcre.backtrack_limit and pcre.recursion_limit since preg_match was silently failing with large strings.

Found this Stack Overflow question which helped find the issue.

@Chemical-Coder
Copy link

Thanks a lot !
You saved my life !
note for others : pcre.backtrack_limit and pcre.recursion_limit works
DO NOT turn off pcre.jit : result in not working at all for bloc replace/clone

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

No branches or pull requests

3 participants