I got a strange exception:
Fatal error: Uncaught exception 'PhpOffice\PhpWord\Exception\Exception' with message 'Invalid parameters passed.' in phpoffice/phpword/src/PhpWord/Writer/Word2007/Part/Rels.php:131
Stack trace:
#0 phpoffice/phpword/src/PhpWord/Writer/Word2007/Part/Rels.php(97): PhpOffice\PhpWord\Writer\Word2007\Part\Rels->writeRel(Object(PhpOffice\Common\XMLWriter), 21, 'officeDocument/...', '', 'External')
#1 phpoffice/phpword/src/PhpWord/Writer/Word2007/Part/Rels.php(71): PhpOffice\PhpWord\Writer\Word2007\Part\Rels->writeMediaRel(Object(PhpOffice\Common\XMLWriter), 21, Array)
#2 phpoffice/phpword/src/PhpWord/Writer/Word2007/Part/RelsDocument.php(46): PhpOffice\PhpWord\Writer\Word2007\Part\Rels->writeRels(Object(PhpOffice\Common\XMLWriter), Array, in phpoffice/phpword/src/PhpWord/Writer/Word2007/Part/Rels.php on line 131
Does someone have any ideas about this issue?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
After some debugs, I found out this is because I use method addLink() to a section and the link is not a link. To be specific it was something like this "".
This is kind of strange because it doesn't say in the exception the exact reason.
I also receive a similar issue due to having an "&" character in text of one of the cells I was adding. Mental note to ensure I encode content for xml before adding to a table in word! :)
After some debugs, I found out this is because I use method addLink() to a section and the link is not a link. To be specific it was something like this "".
This is kind of strange because it doesn't say in the exception the exact reason.
@phuwin Oh man. I should buy you a nice big coffee. I had the same bug in the code. I "iffed" one addLink() line and forgot about the second that also was using undefined url (it was optional for the user).
I was really close to disable some big functionality just to deploy the app but then I found this and was able to fix it quickly.
Thanks a lot!
Most helpful comment
After some debugs, I found out this is because I use method addLink() to a section and the link is not a link. To be specific it was something like this "".
This is kind of strange because it doesn't say in the exception the exact reason.