From e3711af8cea04cd78dbbe6c4571d0cc66046c6db Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sat, 9 Mar 2024 14:58:57 +0100 Subject: [PATCH] Add ZPP checks in DOMNode::{__sleep,__wakeup} Closes GH-13651. --- NEWS | 3 +++ ext/dom/node.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/NEWS b/NEWS index f53996ae660..785fa531bd5 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ PHP NEWS . Fixed bug GH-13612 (Corrupted memory in destructor with weak references). (nielsdos) +- DOM: + . Add some missing ZPP checks. (nielsdos) + - Gettext: . Fixed sigabrt raised with dcgettext/dcngettext calls with gettext 0.22.5 with category set to LC_ALL. (David Carlier) diff --git a/ext/dom/node.c b/ext/dom/node.c index e80939db14d..973505c5b01 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -1797,12 +1797,20 @@ PHP_METHOD(DOMNode, getLineNo) PHP_METHOD(DOMNode, __sleep) { + if (zend_parse_parameters_none() != SUCCESS) { + RETURN_THROWS(); + } + zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed, unless serialization methods are implemented in a subclass", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name)); RETURN_THROWS(); } PHP_METHOD(DOMNode, __wakeup) { + if (zend_parse_parameters_none() != SUCCESS) { + RETURN_THROWS(); + } + zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed, unless unserialization methods are implemented in a subclass", ZSTR_VAL(Z_OBJCE_P(ZEND_THIS)->name)); RETURN_THROWS(); }