Compare commits

...

1 Commits

Author SHA1 Message Date
chaim ffc60a6c0f fix: regex was matching w:tbl, w:tc, w:tr — corrupting DOCX XML
The previous regex /<w:t(?!...)/ matched any tag starting with <w:t
including <w:tbl>, <w:tc>, <w:tr>. Added lookahead (?=[ >/]) to only
match <w:t> elements (followed by space, > or /).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 21:44:22 +00:00
2 changed files with 2 additions and 2 deletions
@@ -380,7 +380,7 @@ class DirectAccessReportGenerator
$zip = new \ZipArchive(); $zip = new \ZipArchive();
if ($zip->open($outputPath) === true) { if ($zip->open($outputPath) === true) {
$xml = $zip->getFromName('word/document.xml'); $xml = $zip->getFromName('word/document.xml');
$xml = preg_replace('/<w:t(?![^>]*xml:space)/', '<w:t xml:space="preserve"', $xml); $xml = preg_replace('/<w:t(?=[ >\/])(?![^>]*xml:space)/', '<w:t xml:space="preserve"', $xml);
$zip->addFromString('word/document.xml', $xml); $zip->addFromString('word/document.xml', $xml);
$zip->close(); $zip->close();
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "LegalAssistance", "name": "LegalAssistance",
"version": "2.0.8", "version": "2.0.9",
"acceptableVersions": [">=8.0.0"], "acceptableVersions": [">=8.0.0"],
"php": [">=8.1"], "php": [">=8.1"],
"releaseDate": "2026-04-09", "releaseDate": "2026-04-09",