mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16316: DOMXPath breaks when not initialized properly
This commit is contained in:
commit
25d0661d21
3 changed files with 41 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -9,6 +9,10 @@ PHP NEWS
|
||||||
. Fixed bug GH-16302 (CurlMultiHandle holds a reference to CurlHandle if
|
. Fixed bug GH-16302 (CurlMultiHandle holds a reference to CurlHandle if
|
||||||
curl_multi_add_handle fails). (timwolla)
|
curl_multi_add_handle fails). (timwolla)
|
||||||
|
|
||||||
|
- DOM:
|
||||||
|
. Fixed bug GH-16316 (DOMXPath breaks when not initialized properly).
|
||||||
|
(nielsdos)
|
||||||
|
|
||||||
- PHPDBG:
|
- PHPDBG:
|
||||||
. Fixed bug GH-16174 (Empty string is an invalid expression for ev). (cmb)
|
. Fixed bug GH-16174 (Empty string is an invalid expression for ev). (cmb)
|
||||||
|
|
||||||
|
|
32
ext/dom/tests/gh16316.phpt
Normal file
32
ext/dom/tests/gh16316.phpt
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
--TEST--
|
||||||
|
GH-16316 (DOMXPath breaks when not initialized properly)
|
||||||
|
--EXTENSIONS--
|
||||||
|
dom
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class Demo extends DOMXPath {
|
||||||
|
public function __construct() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
$demo = new Demo;
|
||||||
|
try {
|
||||||
|
var_dump($demo);
|
||||||
|
} catch (DOMException $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
var_dump($demo->document);
|
||||||
|
} catch (DOMException $e) {
|
||||||
|
echo $e->getMessage(), "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
object(Demo)#1 (1) {
|
||||||
|
["registerNodeNamespaces"]=>
|
||||||
|
bool(true)
|
||||||
|
}
|
||||||
|
Invalid State Error
|
||||||
|
Invalid State Error
|
|
@ -178,6 +178,11 @@ zend_result dom_xpath_document_read(dom_object *obj, zval *retval)
|
||||||
docp = (xmlDocPtr) ctx->doc;
|
docp = (xmlDocPtr) ctx->doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UNEXPECTED(!docp)) {
|
||||||
|
php_dom_throw_error(INVALID_STATE_ERR, /* strict */ true);
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
php_dom_create_object((xmlNodePtr) docp, retval, obj);
|
php_dom_create_object((xmlNodePtr) docp, retval, obj);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue