[
https://issues.apache.org/jira/browse/SHINDIG-1103?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12725107#action_12725107
]
Chris Chabot commented on SHINDIG-1103:
---------------------------------------
Hey Lipeng,
libxml2's html loading is notoriously picky and easy to anger when it comes to
<script></script> blocks; It's also used for os-template and os-data script
block parsing, and the only way that I got it not to break on that was by
regex'ing out those os-template/data script blocks and parse them separately ..
otherwise it would do exactly what you're seeing here, remove all the trailing
tags.
Kevin's solution is the only one that works for now.. and the only viable
alternative would be to implement a HTML parser from scratch, the available
open source ones are either huge (and lots of code == very very slow PHP
execution, so not acceptable) or just downright buggy.. which might be fine if
you're making a email generator, but won't do at all for Shindig.
> The bug is that DOMDocument->loadHtml will remove tages like </b> in script.
> ----------------------------------------------------------------------------
>
> Key: SHINDIG-1103
> URL: https://issues.apache.org/jira/browse/SHINDIG-1103
> Project: Shindig
> Issue Type: Bug
> Components: PHP
> Affects Versions: trunk
> Reporter: lipeng
> Fix For: trunk
>
> Attachments: index-rewriter-test.patch
>
>
> Fixed shindig/php/test/index.php, We can request
> "http://shindig/test/index.php?test=GadgetRewriterTest" to get
> GadgetRewriterTest's result.
> Added shindig/php/test/gadgets/GadgetRewriterTest.php, To test when activate
> rewriter by rewrite_by_default=true, the rewrite code should change content
> within the content tag in application xml.
> <code>
> <Content type="html" view="default">
> <script>var test='<b>BIG WORDS</b>'</script>
> <h1>Hello, world!</h1>
> </Content>
> </code>
> be changed to
> <code>
> <script>var test='<b>BIG WORDS'</script>
> <h1>Hello, world!</h1>
> </code>
> The bug is that DOMDocument->loadHtml will remove tages like </b> in script.
> Every loadHtml calling has that problem. Do you have any solution for this?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.