当以下代码运行时,HTMLPurifier将会死机 [英] HTMLPurifier dies when the following code is run through it
问题描述
以下代码将导致PHP中可爱的空白白页。我错过了什么吗?即使我将HTML.TidyLevel设置为 light
或 none
它仍然会中断。以下是尝试纯化以下代码时抛出的错误的部分日志: http://pastie.org/private / 13f0htscq0v8bhhlt7dpg
为了参考,这里是我使用的相关代码:
$ config = new HTMLPurifier_Config(new HTMLPurifier_ConfigSchema());
$ config-> set('HTML.TidyLevel','light'); //断开任何级别,甚至'none'
self :: $ pure = new HTMLPurifier($ config);
self :: $ pure-> purify($ str); // $ str包含以下代码
最后,违规代码:
< code>
< style type =text / css>
.block {
position:relative;
}
.block h2 a span {
position:absolute;
顶部:0;
left:0;
width:100%;
height:100%;
outline:1px dotted#000;
}
< / style>
< div class =block>
< h2< a href =#>< span>< / span>块的标题< / a>< / h2>
< p>这整个块是可点击的< / p>
< ul>
< li>使用< / li>
< li>任何< / li>
< li>标记你喜欢< / li>
< / ul>
< div>甚至更多的div!< / div>
< p>而不用担心该元素是否被允许作为锚的子节点< / p>
< / div>
< / code>
删除您的htmlpurifier目录,并从tarball。
Using the latest release of HTMLPurifier with default configs.
The following code will cause the oh-so-lovely blank white page in PHP. Am I missing something? Even if I set HTML.TidyLevel to light
or none
it still breaks. Here is a partial log of the errors thrown when trying to purify the code below: http://pastie.org/private/13f0htscq0v8bhhlt7dpg
For reference, here is the associated code I'm using to do it:
$config = new HTMLPurifier_Config(new HTMLPurifier_ConfigSchema());
$config->set('HTML.TidyLevel', 'light'); // breaks with any level, even 'none'
self::$pure = new HTMLPurifier($config);
self::$pure->purify($str); // $str contains the code below
And, finally, the offending code:
<code>
<style type="text/css">
.block {
position: relative;
}
.block h2 a span {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
outline: 1px dashed #000;
}
</style>
<div class="block">
<h2><a href="#"><span></span>Title of block</a></h2>
<p>This entire block is clickable</p>
<ul>
<li>Use</li>
<li>Any</li>
<li>Markup you like</li>
</ul>
<div>Even more divs!</div>
<p>without worrying about whether the element is allowed to be a child of an anchor</p>
</div>
</code>
Delete your htmlpurifier directory and install a fresh copy from the tarball.
这篇关于当以下代码运行时,HTMLPurifier将会死机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!