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>
This commit is contained in:
+1
-1
@@ -380,7 +380,7 @@ class DirectAccessReportGenerator
|
||||
$zip = new \ZipArchive();
|
||||
if ($zip->open($outputPath) === true) {
|
||||
$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->close();
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "LegalAssistance",
|
||||
"version": "2.0.8",
|
||||
"version": "2.0.9",
|
||||
"acceptableVersions": [">=8.0.0"],
|
||||
"php": [">=8.1"],
|
||||
"releaseDate": "2026-04-09",
|
||||
|
||||
Reference in New Issue
Block a user