-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught crash with html header or footer caused by wrong length estimation #464
Comments
Hello @Adelysnet! Could you provide a reproducible gist or any equivalent ? It is hard tell what could be wrong with the information you currently provided. Did you manage to spot anything that could help ? |
Hi Antoine, here is the Gist : https://gist.github.com/Adelysnet/8c52f20f06b82192aec4ecfb8e6cfd7f Just call the generatePDF method like so : Env : Romain |
Hi @Adelysnet , You wrote that "some times" the generation fails. Do you know every how many generation it fails? Do you have the message that triggered the 500 error code? |
Hello @Adelysnet, |
Hi @alexpozzi |
Oh! You are right, my bad, I missed that. |
Hi,
i don't know the exact reason, but some times, html headers|footers (strings) sent in option don't pass the isFile test, crashing with a 500 error code. i suppose, depending of the encoding (utf8 in my case), the value length is miscalculated and this test fails in the AbstractGenerator (line 695) :
protected function isFile($filename)
{
return \strlen($filename) <= \PHP_MAXPATHLEN && \is_file($filename);
}
causing the is_file function to crash. I tried to replace strlen by mb_strlen without success but add an error control operator @\is_file does the trick :
protected function isFile($filename) { return \strlen($filename) <= \PHP_MAXPATHLEN && @\is_file($filename); }
The text was updated successfully, but these errors were encountered: