-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
I have a DivisionByZeroError due to a null value in the division #3530
Comments
Pull requests are always welcome. It would help diagnose the issue to know what from the CSS is causing the issue, but if you are unable to identify it I might be able to do so if you provide some sample code. |
I leave here a repo where you can reproduce the error: https://github.com/mmanzano/dompdf-issue-3530 The problematic CSS is in this file: https://github.com/mmanzano/dompdf-issue-3530/blob/main/resources/views/pdf.blade.php If I'm not wrong, It's something related with the I left in the readme some instructions in order to reproduce the exception in a computer without php installed (just in case). Let me know if you need more directions: https://github.com/mmanzano/dompdf-issue-3530/blob/main/README.md Thanks for your answer. 👍 |
@bsweeney did you have time to take a look into the issue? ❤️ |
I have not had a chance to look into it yet. I can confirm this is happening. Looks like the calc function is running even though the variable hasn't been set. Additionally, the calc isn't re-run later once the variable is set. I'll see if I can figure out how to address (besides adding a null check). |
So, there are two issues here:
I should be able to address both issues in the next release. In the meantime, I believe if you just replace the escaped characters (e.g., change the class to something like |
This change prevents logic or rendering errors in scenarios where a CSS calc function utilizes a non-existent variable as one of the operands. ref #3530
This line is protecting us from 0.0 value but not for null values. Is there a reason to not think about an scenario where $rightValue could be null?
dompdf/src/Css/Style.php
Line 1355 in e832837
I have problems due to that when I use tailwind in order to styling a document. In my end when I remove the line
@tailwind components
the issue is gone so I don't know if something is wrong in Tailwind. I've tried to change the condition to$rightValue === null || $rightValue === 0.0
and it works. Could I make a PR with this?. I'm asking because maybe I'm missing something. I don't want to do the PR without explaining my reasoning before.The text was updated successfully, but these errors were encountered: