From 52854e2796bff1ab2e69991b1c233c277542a0fc Mon Sep 17 00:00:00 2001 From: Joe McGill Date: Wed, 6 Dec 2023 16:03:48 +0000 Subject: [PATCH] HTML-API: Prevent unintended behavior when WP_HTML_Token is unserialized. Props dmsnell, peterwilsoncc, dd32, xknown, rawrly, johnbillion, barry, jeffpaul, vortfu, isabel_brison, mikeschroder, jorbin. git-svn-id: https://develop.svn.wordpress.org/trunk@57163 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/html-api/class-wp-html-token.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/wp-includes/html-api/class-wp-html-token.php b/src/wp-includes/html-api/class-wp-html-token.php index f6edd5235579d..86dd7658cfcee 100644 --- a/src/wp-includes/html-api/class-wp-html-token.php +++ b/src/wp-includes/html-api/class-wp-html-token.php @@ -94,4 +94,13 @@ public function __destruct() { call_user_func( $this->on_destroy, $this->bookmark_name ); } } + + /** + * Wakeup magic method. + * + * @since 6.4.2 + */ + public function __wakeup() { + throw new \LogicException( __CLASS__ . ' should never be unserialized' ); + } }