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

Fix regex in cloneBlock function #1269

Merged
merged 182 commits into from
Jul 18, 2018

Conversation

nicoder
Copy link
Contributor

@nicoder nicoder commented Feb 2, 2018

it wrongly matched <w:pPr when looking for <w:p

in that case the cloned block would not be valid XML,
and so the generated docx document could not be opened by Word.

adding the \b word boundary to the regex fixes this.

the accompanying unit test failed with this message when trying to load
the generated file:

ErrorException: DOMDocument::loadXML(): Opening and ending tag mismatch:
p line 2 and body in Entity, line: 2

Fixes #681 and #664.

FrankMeyer and others added 17 commits July 21, 2015 14:07
added options 'showAxisLabels', 'showGridX', 'showGridY' to charts style element
removed whitespace
changed inline if statement
Fix a typo (d-M-yyy H:mm), and expand the list of valid date formats.
Time formats should either be "h" or "HH".  There were some formats
which were incorrectly specified as "H".
Delete VERSION file since it's outdated so not usefull anymore
it wrongly matched `<w:pPr` when looking for `<w:p`

in that case the cloned block would not be valid XML,
and so the generated docx document could not be opened by Word

adding the `\b` word boundary to the regex fixes this.

the accompanying unit test failed with this message when trying to load
the generated file:

```
ErrorException: DOMDocument::loadXML(): Opening and ending tag mismatch:
p line 2 and body in Entity, line: 2
```

This might solve issues such as PHPOffice#681 and PHPOffice#664.
@nicoder
Copy link
Contributor Author

nicoder commented Feb 6, 2018

Hi,

If / when this is merged I would like to open an other pull request to teach cloneBlock to only clone some of the blocks with that name.

By giving it the same $limit parameter as setValue has.

troosan and others added 26 commits June 3, 2018 22:36
* Require `ext-zip` for development
* Require `ext-gd` for development
…loader

disable entity loader before parsing XML to avoid XXE injection
* Added Support for Indentation  & Tabs on RTF Writer.
* add decimal tab writer + tests
* Update CHANGELOG.md
Support reading of w:drawing for documents produced by word 2011+
allows decimal numbers in line-height style
@troosan troosan changed the title improve cloneBlock regex Fix regex in cloneBlock function Jul 18, 2018
@troosan troosan added this to the v0.16.0 milestone Jul 18, 2018
@troosan troosan merged commit f376f20 into PHPOffice:develop Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

unreadable file content generated using template processor