diff --git a/NEWS b/NEWS index 510537e6a86..2d6670b9631 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ PHP NEWS . Fixed bug GH-16054 (Segmentation fault when resizing hash table iterator list while adding). (nielsdos) . Fixed bug GH-15905 (Assertion failure for TRACK_VARS_SERVER). (cmb) + . Fixed bug GH-15907 (Failed assertion when promoting Serialize deprecation to + exception). (ilutov) - DOM: . Fixed bug GH-16039 (Segmentation fault (access null pointer) in diff --git a/Zend/tests/gh15907.phpt b/Zend/tests/gh15907.phpt new file mode 100644 index 00000000000..8d6dada36ad --- /dev/null +++ b/Zend/tests/gh15907.phpt @@ -0,0 +1,18 @@ +--TEST-- +GH-15907: Failed assertion when promoting inheritance error to exception +--FILE-- + +--EXPECTF-- +Fatal error: During inheritance of C, while implementing Serializable: Uncaught Exception: C implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in %s:%d +%a diff --git a/Zend/zend_interfaces.c b/Zend/zend_interfaces.c index caa96f9cf5e..13cf6966055 100644 --- a/Zend/zend_interfaces.c +++ b/Zend/zend_interfaces.c @@ -474,6 +474,10 @@ static int zend_implement_serializable(zend_class_entry *interface, zend_class_e if (!(class_type->ce_flags & ZEND_ACC_EXPLICIT_ABSTRACT_CLASS) && (!class_type->__serialize || !class_type->__unserialize)) { zend_error(E_DEPRECATED, "%s implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)", ZSTR_VAL(class_type->name)); + if (EG(exception)) { + zend_exception_uncaught_error( + "During inheritance of %s, while implementing Serializable", ZSTR_VAL(class_type->name)); + } } return SUCCESS; }