We use a PDF package called mPDF which I believe comes from here:
https://github.com/mpdf/mpdf
In our codebase, awkwardly, this lives in directory
modules/AOS_PDF_Templates/PDF_Lib/
We seem to be using mPDF version 5.7.1, dated Sep/2013, so over 5 years old. This version is no longer supported. The latest in that 5.7 branch is 5.7.4, from 2014.
The most current version is 8.0.0, it just came out.
The version we use doesn't support PHP 7.x, and as more people move to 7.x (which we say we support), the problems start to get more frequent.
One particularly nasty manifestation of this problem is that PHP warnings are getting dumped inside the generated PDF file, thus making it corrupt and unopenable. This should probably be fixed regardless of any version updates.
I've created #7118 for this
Now that we have a proposed fix (yay 馃帀 !) does anybody have a clue about why PHP warnings are dumped inside the generated PDF file? Is this something we need to fix in our code or is it an mPDF problem?
No idea. Do you know a way to reproduce the error?
Sort of. I couldn't see this happening in my own installation, so maybe there is some other factor that I am unaware of.
But the basic idea is to make PHP throw a warning like the ones you see here (read through a few posts)
https://suitecrm.com/suitecrm/forum/feedback/22105-print-as-pdf-error
Let's just hope you can get the error to appear for you...
Oh, that's because they have display_errors on, which injects the error messages as HTML into the php output, and should never be enabled in production.
I agree it should be disabled, but does PHP output have to go into the PDF, is that the only way that mPDF works? I think we should fail more gracefully here.
Maybe turn off display_errors from code before starting the PDF generation, and then setting it back the way it was in the end, I don't know...
@Dillon-Brown let's not neglect the "warnings inside the PDF" Issue, it keeps coming up in the forums lately.
@pgorod #7322 and #7323 should hopefully resolve the warnings inside the PDF issue.
This is fixed in develop now I think?
@Dillon-Brown can you please help me understand the status on this one?
hotfix-7.8.x which is EOLhotfix-7.10.x) is not merged yet, probably for no reason except lack of time while we were doing other thingsSo I am seeing another user complaining about the warnings inside PDF files in the Forums, with 7.11.8.
My question is if #7323 is dependent on this one here for some reason, or if we can go ahead and merge it.
@pgorod So it looks like the original "Update mPDF and move it to composer" was completed here: #7118 but it can probably be backported to 7.10.x/7.11.x now.
For the second part of this issue "PHP warnings are getting dumped inside the generated PDF file". It's still a WIP here #7323, not sure where I actually got with it but it should be able to go into hotfix-7.10.x without the composerify PR being included.
Most helpful comment
I've created #7118 for this