HTML API: Fix a bug where the namespace was forced to 'html'

While working on other reviews and audits, a bug was discovered in the HTML API where the wrong namespace was being assigned to a token because the default value of 'html' was used. This patch fixes the bug by calling the `parent::get_namespace()` method instead of assuming 'html'.

Developed in https://github.com/wordpress/wordpress-develop/7232
Discussed in https://core.trac.wordpress.org/ticket/61576

Follow-up to [58868].

Props jonsurrell.
See #61576.

Built from https://develop.svn.wordpress.org/trunk@58940


git-svn-id: http://core.svn.wordpress.org/trunk@58336 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-08-27 03:37:12 +00:00
parent bd20e0e8d2
commit 813d784931
2 changed files with 2 additions and 2 deletions

View File

@ -4704,7 +4704,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
*/
public function get_namespace(): string {
if ( ! isset( $this->current_element ) ) {
return 'html';
return parent::get_namespace();
}
return $this->current_element->token->namespace;

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-58939';
$wp_version = '6.7-alpha-58940';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.