Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 8.5.0alpha2

- DOM:
. Make cloning DOM node lists, maps, and collections fail. (nielsdos)

- PDO_ODBC
. Fetch larger block sizes and better handle SQL_NO_TOTAL when calling
SQLGetData. (Calvin Buckley, Saki Takamachi)
Expand Down
6 changes: 6 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ PHP 8.5 UPGRADE NOTES
change, but should more closely match user expectations, demonstrated by
GH-15753 and GH-16198.

- DOM:
. Cloning a DOMNamedNodeMap, DOMNodeList, Dom\NamedNodeMap, Dom\NodeList,
Dom\HTMLCollection, and Dom\DtdNamedNodeMap now fails.
This never actually resulted in a working object,
so the impact should actually be zero.

- FileInfo:
. finfo_file() and finfo::file() now throws a ValueError instead of a
TypeError when $filename contains nul bytes.
Expand Down
2 changes: 1 addition & 1 deletion UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PHP 8.5 INTERNALS UPGRADE NOTES
. Preprocessor macro SIZEOF_INTMAX_T has been removed.

- Windows build system changes
. SAPI() and ADD_SOURCES() now suport the optional `duplicate_sources`
. SAPI() and ADD_SOURCES() now support the optional `duplicate_sources`
parameter. If truthy, no rules to build the object files are generated.
This allows to build additional variants of SAPIs (e.g. a DLL and EXE)
without duplicate build rules. It is up to the SAPI maintainers to ensure
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_language_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ case_separator:

match:
T_MATCH '(' expr ')' '{' match_arm_list '}'
{ $$ = zend_ast_create(ZEND_AST_MATCH, $3, $6); };
{ $$ = zend_ast_create(ZEND_AST_MATCH, $3, $6); }
;

match_arm_list:
Expand Down
4 changes: 0 additions & 4 deletions ext/dom/namednodemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@
zend_long php_dom_get_namednodemap_length(dom_object *obj)
{
dom_nnodemap_object *objmap = obj->ptr;
if (!objmap) {
return 0;
}

return objmap->handler->length(objmap);
}

Expand Down
3 changes: 0 additions & 3 deletions ext/dom/obj_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,6 @@ static void dom_map_get_null_item(dom_nnodemap_object *map, zend_long index, zva
zend_long php_dom_get_nodelist_length(dom_object *obj)
{
dom_nnodemap_object *objmap = obj->ptr;
if (!objmap) {
return 0;
}

if (objmap->handler->use_cache) {
xmlNodePtr nodep = dom_object_get_node(objmap->baseobj);
Expand Down
2 changes: 1 addition & 1 deletion ext/dom/php_dom.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@ PHP_MINIT_FUNCTION(dom)
dom_nnodemap_object_handlers.free_obj = dom_nnodemap_objects_free_storage;
dom_nnodemap_object_handlers.read_dimension = dom_nodemap_read_dimension;
dom_nnodemap_object_handlers.has_dimension = dom_nodemap_has_dimension;
dom_nnodemap_object_handlers.clone_obj = NULL;

memcpy(&dom_nodelist_object_handlers, &dom_nnodemap_object_handlers, sizeof(zend_object_handlers));
dom_nodelist_object_handlers.read_dimension = dom_nodelist_read_dimension;
Expand All @@ -823,7 +824,6 @@ PHP_MINIT_FUNCTION(dom)
dom_html_collection_object_handlers.read_dimension = dom_html_collection_read_dimension;
dom_html_collection_object_handlers.has_dimension = dom_html_collection_has_dimension;
dom_html_collection_object_handlers.get_gc = dom_html_collection_get_gc;
dom_html_collection_object_handlers.clone_obj = NULL;

memcpy(&dom_object_namespace_node_handlers, &dom_object_handlers, sizeof(zend_object_handlers));
dom_object_namespace_node_handlers.offset = XtOffsetOf(dom_object_namespace_node, dom.std);
Expand Down
50 changes: 50 additions & 0 deletions ext/dom/tests/clone_list_map_collection.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
--TEST--
Cloning node lists, maps, and collections should fail
--EXTENSIONS--
dom
--FILE--
<?php

$dom = new DOMDocument;
$dom->loadXML('<root a="1"><a/></root>');
try {
clone $dom->documentElement->attributes;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
clone $dom->documentElement->childNodes;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

$dom = Dom\XMLDocument::createFromString('<!DOCTYPE root [<!ENTITY foo "">]><root a="1"><a/></root>');
try {
clone $dom->documentElement->attributes;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
clone $dom->documentElement->childNodes;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
clone $dom->documentElement->children;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
clone $dom->doctype->entities;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}

?>
--EXPECT--
Trying to clone an uncloneable object of class DOMNamedNodeMap
Trying to clone an uncloneable object of class DOMNodeList
Trying to clone an uncloneable object of class Dom\NamedNodeMap
Trying to clone an uncloneable object of class Dom\NodeList
Trying to clone an uncloneable object of class Dom\HTMLCollection
Trying to clone an uncloneable object of class Dom\DtdNamedNodeMap