Skip to content

Commit

Permalink
HTML API: Prevent Open Elements class from waking up.
Browse files Browse the repository at this point in the history
This class accepts a Closure, but it should not be possible
to wake up with one from a serialized class instance.

Developed in #6852
Discussed in https://core.trac.wordpress.org/ticket/61348

Props jonsurrell.
See #61348.
Follow-up to [58304].


git-svn-id: https://develop.svn.wordpress.org/trunk@58441 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
dmsnell committed Jun 18, 2024
1 parent 483f219 commit 2132c7b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/wp-includes/html-api/class-wp-html-open-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -517,4 +517,13 @@ public function after_element_pop( $item ) {
( $this->pop_handler )( $item );
}
}

/**
* Wakeup magic method.
*
* @since 6.6.0
*/
public function __wakeup() {
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
}
}

0 comments on commit 2132c7b

Please sign in to comment.