Skip to content

PHP with tidy and custom-tags #20374

@franck-paul

Description

@franck-paul

Description

The following code:

<?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

Operating System

MacOS

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions