Forum


Replies: 2   Views: 3343
Patch: fixing clearblocks() procuding corrupted documents
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by thomasbachem  · 13-01-2012 - 12:02

CreateDocx::clearBlocks()/CreateTemplate::deleteAllBlocks() deleted some <w:p>s in my documents that didn't contain any block placeholder and hence corrupted the document.

I managed to fix the bug with the following one-line patch:
[code]
--- phpdocx_pro/classes/CreateTemplate.inc
+++ phpdocx_pro/classes/CreateTemplate.inc
@@ -420,8 +420,8 @@
$query = 'w:r/w:t';
for ($i = 0; $i < $length; $i++) {
$variables = $xpath->query($query, $itemsWP[$i]);
+ $deleteCurrent = false;
foreach ($variables as $entry) {
- $deleteCurrent = false;
if (
strpos($entry->nodeValue,
self::$_templateSymbol . 'BLOCK_'
[/code]

Posted by admin  · 11-04-2013 - 12:13

Thanks, we'll check this patch to be added on phpdocx.