You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?php$str = '<custom-html-element>test</custom-html-element>';
$config = [
'custom-tags' => 'blocklevel',
];
$tidy = new \tidy();
$tidy->parseString($str, $config, 'utf8');
$tidy->cleanRepair();
$str = (string) $tidy->value;
var_dump($str); // should be <custom-html-element>test</custom-html-element>
Resulted in this output:
test
But I expected this output instead:
<custom-html-element>test</custom-html-element>
PHP Version
PHP 8.4.14 (cli) (built: Oct 21 2025 19:23:55) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.4.14, Copyright (c) Zend Technologies
with Zend OPcache v8.4.14, Copyright (c), by Zend Technologies
with Xdebug v3.4.0, Copyright (c) 2002-2024, by Derick Rethans
Activity
ndossche commentedon Nov 3, 2025
I'll take a look. Enum translation appears to be broken.
As a workaround for now you can use
'custom-tags' => 1,ndossche commentedon Nov 3, 2025
On first sight the following would work, but have to double check (and probably add support for the IS_LONG case):
Adjust HtmlFilter for custom tags, but tidy is buggy about that (php/…
Fix GH-20374: PHP with tidy and custom-tags
Merge branch 'PHP-8.3' into PHP-8.4
Merge branch 'PHP-8.4' into PHP-8.5
Merge branch 'PHP-8.5'
franck-paul commentedon Nov 4, 2025
I tried this value but the custom tag is still missing from output.
ndossche commentedon Nov 4, 2025
The following code:
Outputs:
for me.
Does this not work for you? What libtidy version do you have installed?