Some control characters are not replaced and causes corrupted file
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 237
- Forks
- 61
- Avg merge
- 1h 2m
- Merged PRs (30d)
- 1
Description
In Text.php, buildControlCharacters() constructs array of control characters, but only characters 0 - 19(without 9, 10, 13).
If i create Word2007 file with some other control character, for example 20, generated file is corrupted.
Sample:
$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();
$section->addText('control char 27(ESC):' . chr(27));
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save('test.docx');
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Text.php at buildControlCharacters(), then reproduce the provided Word2007 example containing chr(27). Verify how control characters outside the currently handled range are processed, and confirm that the resulting test.docx opens without corruption.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100