File tree 3 files changed +40
-0
lines changed 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ PHP NEWS
2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? ????, PHP 8.3.13
4
4
5
+ - DOM:
6
+ . Fixed bug GH-16039 (Segmentation fault (access null pointer) in
7
+ ext/dom/parentnode/tree.c). (nielsdos)
8
+
5
9
- PHPDBG:
6
10
. Fixed bug GH-15901 (phpdbg: Assertion failure on i funcs). (cmb)
7
11
Original file line number Diff line number Diff line change @@ -265,6 +265,11 @@ static zend_result dom_sanity_check_node_list_for_insertion(php_libxml_ref_obj *
265
265
if (instanceof_function (ce , dom_node_class_entry )) {
266
266
xmlNodePtr node = dom_object_get_node (Z_DOMOBJ_P (nodes + i ));
267
267
268
+ if (!node ) {
269
+ php_dom_throw_error (INVALID_STATE_ERR , /* strict */ true);
270
+ return FAILURE ;
271
+ }
272
+
268
273
if (node -> doc != documentNode ) {
269
274
php_dom_throw_error (WRONG_DOCUMENT_ERR , dom_get_strict_error (document ));
270
275
return FAILURE ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-16039 (Segmentation fault (access null pointer) in ext/dom/parentnode/tree.c)
3
+ --EXTENSIONS--
4
+ dom
5
+ --FILE--
6
+ <?php
7
+
8
+ $ dom = new DOMDocument ;
9
+ $ element = $ dom ->appendChild ($ dom ->createElement ('root ' ));
10
+ try {
11
+ $ element ->prepend ('x ' , new DOMEntity );
12
+ } catch (DOMException $ e ) {
13
+ echo $ e ->getMessage (), "\n" ;
14
+ }
15
+ echo $ dom ->saveXML ();
16
+ $ dom ->strictErrorChecking = false ; // Should not have influence
17
+ try {
18
+ $ element ->prepend ('x ' , new DOMEntity );
19
+ } catch (DOMException $ e ) {
20
+ echo $ e ->getMessage (), "\n" ;
21
+ }
22
+ echo $ dom ->saveXML ();
23
+
24
+ ?>
25
+ --EXPECT--
26
+ Invalid State Error
27
+ <? xml version="1.0 "?>
28
+ <root/>
29
+ Invalid State Error
30
+ <? xml version="1.0 "?>
31
+ <root/>
You can’t perform that action at this time.
0 commit comments