-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix: CloneBlock regexp for different regexp engine with xml line-drop #1801
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
Conversation
Update PR: #1809 |
I encountered an I issue where my blocks were not cloned (basically preg_match didn't match anything). I changed regex to what's used here, and it was fixed. Can we merge this ? |
@Herz3h Feel free to use it. Or you can use my fork repo here: https://github.com/JuzSer/PHPWord |
Would prefer to have it merged, so I don't forget later on that I'm using your repo instead of the official one in my composer ;) |
In my case, it works if pcre.jit is enabled on php 7.3.6. And it will also work if pcre.backtrack-limit is big enough when pcre.jit. is disabled. Those might not be good solutions, but could be served as temporary solution before the official fix. |
@xu-li Yes, I see that problem before, long time ago I posted an update PR here: #1809 |
Thanks, @juzser . Yes, I saw your PR, tried that and it worked in my particular case. I didn't use your code because:
It's just my personal preference. I want to play on the safe side. It has nothing to do with your code. |
Yes, of course. I've tested my regexp with some cases, I think it safe but yes, you're correct, maybe I missed something that I don't know. I'm just waiting for the package's owner to check this issue.. But seem likes he has no longer maintenance this package, maybe. |
merged #1809 |
Description
Reference Issue: #1800
When you have multiple Blocks in multiple Rows, some of blocks cannot be replaced
Only the last block was replaced.
This because some word file will drop-line after
xml
tag, and the regular expression engine in different versions cannot find the matched block.Fixes # (issue)
File:
TemplateProcessor.php
Line: 740
Change the regexp pattern to:
Describe:
<w:p
tag that closest to the blockname.<w:p
does not contain any other<w:p
inside it.Checklist:
All Done
composer run-script check --timeout=0
and no errors were reported