File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ PHP NEWS
9
9
. Fixed bug GH-16302 (CurlMultiHandle holds a reference to CurlHandle if
10
10
curl_multi_add_handle fails). (timwolla)
11
11
12
+ - DOM:
13
+ . Fixed bug GH-16316 (DOMXPath breaks when not initialized properly).
14
+ (nielsdos)
15
+
12
16
- PHPDBG:
13
17
. Fixed bug GH-16174 (Empty string is an invalid expression for ev). (cmb)
14
18
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-16316 (DOMXPath breaks when not initialized properly)
3
+ --EXTENSIONS--
4
+ dom
5
+ --FILE--
6
+ <?php
7
+
8
+ class Demo extends DOMXPath {
9
+ public function __construct () {}
10
+ }
11
+
12
+ $ demo = new Demo ;
13
+ try {
14
+ var_dump ($ demo );
15
+ } catch (DOMException $ e ) {
16
+ echo $ e ->getMessage (), "\n" ;
17
+ }
18
+
19
+ try {
20
+ var_dump ($ demo ->document );
21
+ } catch (DOMException $ e ) {
22
+ echo $ e ->getMessage (), "\n" ;
23
+ }
24
+
25
+ ?>
26
+ --EXPECT--
27
+ object(Demo)#1 (1) {
28
+ ["registerNodeNamespaces"]=>
29
+ bool(true)
30
+ }
31
+ Invalid State Error
32
+ Invalid State Error
Original file line number Diff line number Diff line change @@ -264,6 +264,11 @@ int dom_xpath_document_read(dom_object *obj, zval *retval)
264
264
docp = (xmlDocPtr ) ctx -> doc ;
265
265
}
266
266
267
+ if (UNEXPECTED (!docp )) {
268
+ php_dom_throw_error (INVALID_STATE_ERR , /* strict */ true);
269
+ return FAILURE ;
270
+ }
271
+
267
272
php_dom_create_object ((xmlNodePtr ) docp , retval , obj );
268
273
return SUCCESS ;
269
274
}
You can’t perform that action at this time.
0 commit comments