Hi,
I am having an issue when using ContentBlocks together with the PDFResource extra.
When I try to save a resource that has create_pdf enabled, I get a 500 error and the progress bar for saving the resource gets stuck in an infinite loop. The PDF is not generated.
There’s the following error in the error log:
[2024-04-16 17:33:43] (ERROR @ /home/web/216508/htdocs/core/components/contentblocks/model/contentblocks/contentblocks.class.php : 602) [ContentBlocks] Could not find input 0 for parsing.
If I disable ContentBlocks for the resource in question, I can save as normal and PDF generation works. Vice versa, if I disable create_pdf but keep ContentBlocks enabled, everything works fine as well.
I already tried changing the value of contentBlocks.default_field to another field’s id or setting it to 0, but the error message stays the same.
Are there any known compatibility issues between these two extras or has anyone encountered a similar problem and knows of a fix/workaround?
(MODX version is 3.0.4-pl, ContentBlocks is v1.13.4-pl and PDFResource is 2.0.1-pl)
[Mon Apr 22 16:33:57.769761 2024] [proxy_fcgi:error] [pid 231387] [client 83.150.14.192:52704] AH01071: Got error 'PHP message: PHP Fatal error: Declaration of Mpdf\\Http\\Request::getRequestTarget() must be compatible with Psr\\Http\\Message\\RequestInterface::getRequestTarget(): string in /home/web/216508/htdocs/core/components/pdfresource/vendor/mpdf/mpdf/src/Http/Request.php on line 69', referer: https://tedamosdev.b7k.ch/manager/?a=resource/update&id=1411
That looks like a psr/http dependency conflict where the mpdf library in pdfresource conflicts with a different version of it - ContentBlocks doesn’t use mpdf nor psr/http though, so I’m not sure where that is coming from…
It seems that the issue was actually caused by the Guzzle7 extra. I came across the following github issue while searching for a solution: Why this extra works in MODX 3? · Issue #5 · modmore/guzzle7 · GitHub
It mentioned a similar compatibility error, so I tried uninstalling the Guzzle7 extra and now PDF generation seems to work just fine with ContentBlocks enabled!
I’ll have to do some more testing to see if I can just leave Guzzle7 uninstalled, but for now the problem seems to be solved. (As far as I understand, Guzzle is included by default in MODX 3.0?)
Thanks for your help!
I’ve released an update to fix that issue in guzzle7, it is still a required dependency for a bunch of extras so those will attempt to reinstall it automatically when you update them.