mirror of
https://github.com/php/php-src.git
synced 2026-04-19 14:01:01 +02:00
The documentation of `tidyNode::isHtml()` states that this method "checks if a node is part of a HTML document". That is, of course, nonsense, since a tidyNode is "an HTML node in an HTML file, as detected by tidy." What this method is actually supposed to do is to check whether a node is an element (unless it is the root element). This has been broken by commit d8eeb8e[1], which assumed that `enum TidyNodeType` would represent flags of a bitmask, what it does not. [1] <http://git.php.net/?p=php-src.git;a=commit;h=d8eeb8e28673236bca3f066ded75037a5bdf6378> Closes GH-6290.
27 lines
641 B
PHP
27 lines
641 B
PHP
--TEST--
|
|
Bug #77040 (tidyNode::isHtml() is completely broken)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('tidy')) die('skip tidy extension not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$tidy = new tidy;
|
|
$tidy->parseString("<p>text</p><p><![CDATA[cdata]]></p>");
|
|
$p = $tidy->body()->child[0];
|
|
var_dump($p->type === TIDY_NODETYPE_START);
|
|
var_dump($p->isHtml());
|
|
$text = $p->child[0];
|
|
var_dump($text->type === TIDY_NODETYPE_TEXT);
|
|
var_dump($text->isHtml());
|
|
$cdata = $tidy->body()->child[1]->child[0];
|
|
var_dump($cdata->type === TIDY_NODETYPE_CDATA);
|
|
var_dump($cdata->isHtml());
|
|
?>
|
|
--EXPECT--
|
|
bool(true)
|
|
bool(true)
|
|
bool(true)
|
|
bool(false)
|
|
bool(true)
|
|
bool(false)
|