-
Notifications
You must be signed in to change notification settings - Fork 187
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
Add LIBXML_NOBLANKS to make the output same on Linux and Windows #204
Conversation
Travis php-nightly fails for unrelated reason: |
The error seems related to php nightly using Xdebug 3 on Travis. |
|
0dd083e
to
891339f
Compare
88fc1f1
to
8c66705
Compare
@stof There is still something I need to investigate in our test suite, because the tests there pass on Windows and fail in CI on Linux, but both environments pass when I use my branch with the I'd like to keep the PR open for now at least until I investigate what the issue is. |
We are using this library through Symfony to inline CSS in e-mails. We are also using snapshot testing for rendered e-mails templates and I discovered that the output of this library differs between Windows (dev machine) and Linux (CI). I tried running the test suite on Windows and the test CssToInlineStylesTest::testSpecificity() fails because of whitespace difference: on Windows there is an extra \n before the closing </a> in the output. I tried loading and saving a a super-simplified HTML <a>\n<img>\n</a> through the DOMDocument without this library but with the same settings and a similar thing happen (newline before </a> is present on Windows but missing on Linux). When the option LIBXML_NOBLANKS is added to loadHTML() the output no longer differs between the Windows and Linux. To be honest, I'm not sure if this is a proper fix. It should be rather considered a bug report with a workaround.
8c66705
to
c2ffc5e
Compare
Surprisingly, the PHP behaviour changed between 8.0.5 and 8.0.14, so the output is same on Windows and Linux even without this patch. |
We are using this library through Symfony to inline CSS in e-mails. We are also
using snapshot testing for rendered e-mails templates and I discovered that the
output of this library differs between Windows (dev machine) and Linux (CI).
I tried running the test suite on Windows and the test
CssToInlineStylesTest::testSpecificity()
fails because of whitespace difference:on Windows there is an extra
\n
before the closing</a>
in the output.I tried loading and saving a a super-simplified HTML
<a>\n<img>\n</a>
through the DOMDocument without this library but with the same settings
and a similar thing happen (newline before is present on Windows but missing
on Linux).
When the option
LIBXML_NOBLANKS
is added toloadHTML()
the output no longerdiffers between the Windows and Linux.
To be honest, I'm not sure if this is a proper fix.
It should be rather considered a bug report with a workaround.