diff --git a/NEWS b/NEWS index 0899163d87b75..b3df4f43c4603 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ PHP NEWS needing to be present beforehand. (ndossche) . Added `clamp()`. (kylekatarnls, thinkverse) +- DOM: + . Removed LIBXML_XINCLUDE from valid options for XMLDocument, + as it was a no-op. (ndossche) + - Fileinfo: . Fixed bug GH-20679 (finfo_file() doesn't work on remote resources). (ndossche) diff --git a/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt b/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt index 13359f4b28585..16db09547bff7 100644 --- a/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt +++ b/ext/dom/tests/modern/xml/XMLDocument_fromString_03.phpt @@ -6,7 +6,7 @@ dom llist, index, intern->flags & SPL_DLLIST_IT_LIFO); if (element != NULL) { - /* connect the neighbors */ + /* disconnect the neighbours */ if (element->prev) { element->prev->next = element->next; } - if (element->next) { element->next->prev = element->prev; } @@ -746,6 +745,10 @@ PHP_METHOD(SplDoublyLinkedList, offsetUnset) llist->tail = element->prev; } + /* Keep consistency if element is kept alive. */ + element->prev = NULL; + element->next = NULL; + /* finally, delete the element */ llist->count--; diff --git a/ext/spl/tests/gh20856.phpt b/ext/spl/tests/gh20856.phpt new file mode 100644 index 0000000000000..8bc1b3c95827c --- /dev/null +++ b/ext/spl/tests/gh20856.phpt @@ -0,0 +1,26 @@ +--TEST-- +GH-20856 (heap-use-after-free in SplDoublyLinkedList iterator when modifying during iteration) +--CREDITS-- +vi3tL0u1s +iluuu1994 +--FILE-- + +--EXPECTF-- +object(SplStack)#%d (%d) { + ["flags":"SplDoublyLinkedList":private]=> + int(6) + ["dllist":"SplDoublyLinkedList":private]=> + array(0) { + } +}