Skip to content
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

Detect XML header CssToInlineStyles::createDomDocumentFromHtml() #139

Closed

Conversation

techi602
Copy link
Contributor

Solve issue with adding xml header twice into DomDocument in #131

(Luckily DomDocument will handle two xml headers anyway)

@@ -101,7 +101,7 @@ public function getInlineStyles(\DOMElement $element)
protected function createDomDocumentFromHtml($html)
{
$html = trim($html);
if (strstr('<?xml', $html) !== 0) {
if (strpos('<?xml', $html) !== 0) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no test to cover the scenario with an XML opening tag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately it is protected method so adding meaningful test is difficult
Initial test was added in previous PR linked in this PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@techi602 you can write tests using the public API which calls this one, i.e. trying to process some HTML containing the XML opening tag

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this test is covered in #131 testHtmlEncoding()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny thing is that this bug has no effect since adding xml header multiple times is ignored by DomDocument therefore is difficult to write failing test in this PR 🙈

@techi602
Copy link
Contributor Author

techi602 commented Sep 5, 2016

Fixed in #154

@techi602 techi602 closed this Sep 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants