Skip to content

Commit

Permalink
HTML API: Fix a bug where the namespace was forced to 'html'
Browse files Browse the repository at this point in the history
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.


git-svn-id: https://develop.svn.wordpress.org/trunk@58940 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
dmsnell committed Aug 27, 2024
1 parent 66febeb commit 19e54cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4704,7 +4704,7 @@ private function bookmark_token() {
*/
public function get_namespace(): string {
if ( ! isset( $this->current_element ) ) {
return 'html';
return parent::get_namespace();
}

return $this->current_element->token->namespace;
Expand Down

0 comments on commit 19e54cc

Please sign in to comment.