mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
Update ext/dom names after policy change (#14171)
This commit is contained in:
parent
0dfd2a93ab
commit
6e7adb3c48
251 changed files with 1501 additions and 1501 deletions
|
@ -184,7 +184,7 @@ PHP_METHOD(DOMCharacterData, appendData)
|
|||
dom_character_data_append_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_CharacterData, appendData)
|
||||
PHP_METHOD(Dom_CharacterData, appendData)
|
||||
{
|
||||
dom_character_data_append_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ PHP_METHOD(DOMCharacterData, insertData)
|
|||
dom_character_data_insert_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_CharacterData, insertData)
|
||||
PHP_METHOD(Dom_CharacterData, insertData)
|
||||
{
|
||||
dom_character_data_insert_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ PHP_METHOD(DOMCharacterData, deleteData)
|
|||
dom_character_data_delete_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_CharacterData, deleteData)
|
||||
PHP_METHOD(Dom_CharacterData, deleteData)
|
||||
{
|
||||
dom_character_data_delete_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ PHP_METHOD(DOMCharacterData, replaceData)
|
|||
dom_character_data_replace_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_CharacterData, replaceData)
|
||||
PHP_METHOD(Dom_CharacterData, replaceData)
|
||||
{
|
||||
dom_character_data_replace_data(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
|
|
@ -457,7 +457,7 @@ PHP_METHOD(DOMDocument, createElement)
|
|||
DOM_RET_OBJ(node, intern);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Document, createElement)
|
||||
PHP_METHOD(Dom_Document, createElement)
|
||||
{
|
||||
xmlNode *node;
|
||||
xmlDocPtr docp;
|
||||
|
@ -662,7 +662,7 @@ PHP_METHOD(DOMDocument, createProcessingInstruction)
|
|||
dom_document_create_processing_instruction(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Document, createProcessingInstruction)
|
||||
PHP_METHOD(Dom_Document, createProcessingInstruction)
|
||||
{
|
||||
dom_document_create_processing_instruction(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -827,13 +827,13 @@ static void dom_modern_document_import_node(INTERNAL_FUNCTION_PARAMETERS, zend_c
|
|||
DOM_RET_OBJ(retnodep, intern);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Document, importNode)
|
||||
PHP_METHOD(Dom_Document, importNode)
|
||||
{
|
||||
dom_modern_document_import_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_modern_node_class_entry);
|
||||
}
|
||||
/* }}} end dom_document_import_node */
|
||||
|
||||
PHP_METHOD(DOM_Document, importLegacyNode)
|
||||
PHP_METHOD(Dom_Document, importLegacyNode)
|
||||
{
|
||||
dom_modern_document_import_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_node_class_entry);
|
||||
}
|
||||
|
@ -893,7 +893,7 @@ PHP_METHOD(DOMDocument, createElementNS)
|
|||
DOM_RET_OBJ(nodep, intern);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Document, createElementNS)
|
||||
PHP_METHOD(Dom_Document, createElementNS)
|
||||
{
|
||||
xmlDocPtr docp;
|
||||
dom_object *intern;
|
||||
|
@ -1199,7 +1199,7 @@ PHP_METHOD(DOMDocument, adoptNode)
|
|||
dom_document_adopt_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Document, adoptNode)
|
||||
PHP_METHOD(Dom_Document, adoptNode)
|
||||
{
|
||||
dom_document_adopt_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -1693,7 +1693,7 @@ PHP_METHOD(DOMDocument, saveXML)
|
|||
dom_document_save_xml(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_node_class_entry);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_XMLDocument, saveXML)
|
||||
PHP_METHOD(Dom_XMLDocument, saveXml)
|
||||
{
|
||||
dom_document_save_xml(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_modern_node_class_entry);
|
||||
}
|
||||
|
@ -2266,7 +2266,7 @@ PHP_METHOD(DOMDocument, registerNodeClass)
|
|||
dom_document_register_node_class(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Document, registerNodeClass)
|
||||
PHP_METHOD(Dom_Document, registerNodeClass)
|
||||
{
|
||||
dom_document_register_node_class(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ PHP_METHOD(DOMImplementation, createDocumentType)
|
|||
DOM_RET_OBJ((xmlNodePtr) doctype, NULL);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Implementation, createDocumentType)
|
||||
PHP_METHOD(Dom_Implementation, createDocumentType)
|
||||
{
|
||||
size_t name_len, publicid_len = 0, systemid_len = 0;
|
||||
const char *name, *publicid = NULL, *systemid = NULL;
|
||||
|
@ -249,7 +249,7 @@ PHP_METHOD(DOMImplementation, createDocument)
|
|||
}
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Implementation, createDocument)
|
||||
PHP_METHOD(Dom_Implementation, createDocument)
|
||||
{
|
||||
zval *dtd = NULL;
|
||||
xmlDtdPtr doctype = NULL;
|
||||
|
@ -343,7 +343,7 @@ error:
|
|||
/* }}} end dom_domimplementation_create_document */
|
||||
|
||||
/* {{{ URL: https://dom.spec.whatwg.org/#dom-domimplementation-createhtmldocument */
|
||||
PHP_METHOD(DOM_Implementation, createHTMLDocument)
|
||||
PHP_METHOD(Dom_Implementation, createHTMLDocument)
|
||||
{
|
||||
const char *title = NULL;
|
||||
size_t title_len = 0;
|
||||
|
|
|
@ -572,7 +572,7 @@ PHP_METHOD(DOMElement, removeAttribute)
|
|||
RETURN_BOOL(dom_remove_attribute(nodep, attrp));
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Element, removeAttribute)
|
||||
PHP_METHOD(Dom_Element, removeAttribute)
|
||||
{
|
||||
xmlNodePtr nodep, attrp;
|
||||
dom_object *intern;
|
||||
|
@ -749,7 +749,7 @@ PHP_METHOD(DOMElement, removeAttributeNode)
|
|||
dom_element_remove_attribute_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_node_class_entry);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Element, removeAttributeNode)
|
||||
PHP_METHOD(Dom_Element, removeAttributeNode)
|
||||
{
|
||||
dom_element_remove_attribute_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_modern_node_class_entry);
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ PHP_METHOD(DOMElement, getElementsByTagName)
|
|||
dom_element_get_elements_by_tag_name(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Element, getElementsByTagName)
|
||||
PHP_METHOD(Dom_Element, getElementsByTagName)
|
||||
{
|
||||
dom_element_get_elements_by_tag_name(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -1172,7 +1172,7 @@ PHP_METHOD(DOMElement, setAttributeNodeNS)
|
|||
dom_element_set_attribute_node_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, /* use_ns */ true, /* modern */ false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Element, setAttributeNodeNS)
|
||||
PHP_METHOD(Dom_Element, setAttributeNodeNS)
|
||||
{
|
||||
dom_element_set_attribute_node_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, /* use_ns */ true, /* modern */ true);
|
||||
}
|
||||
|
@ -1208,7 +1208,7 @@ PHP_METHOD(DOMElement, getElementsByTagNameNS)
|
|||
dom_element_get_elements_by_tag_name_ns(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Element, getElementsByTagNameNS)
|
||||
PHP_METHOD(Dom_Element, getElementsByTagNameNS)
|
||||
{
|
||||
dom_element_get_elements_by_tag_name_ns(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -1387,7 +1387,7 @@ PHP_METHOD(DOMElement, setIdAttributeNode)
|
|||
dom_element_set_id_attribute_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_attr_class_entry);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Element, setIdAttributeNode)
|
||||
PHP_METHOD(Dom_Element, setIdAttributeNode)
|
||||
{
|
||||
dom_element_set_id_attribute_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_modern_attr_class_entry);
|
||||
}
|
||||
|
@ -1595,7 +1595,7 @@ PHP_METHOD(DOMElement, insertAdjacentElement)
|
|||
dom_element_insert_adjacent_element(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_element_class_entry);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Element, insertAdjacentElement)
|
||||
PHP_METHOD(Dom_Element, insertAdjacentElement)
|
||||
{
|
||||
dom_element_insert_adjacent_element(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_modern_element_class_entry);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ static void dom_html_collection_named_item_into_zval(zval *return_value, zend_st
|
|||
}
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_HTMLCollection, namedItem)
|
||||
PHP_METHOD(Dom_HTMLCollection, namedItem)
|
||||
{
|
||||
zend_string *key;
|
||||
ZEND_PARSE_PARAMETERS_START(1, 1)
|
||||
|
|
|
@ -722,13 +722,13 @@ static bool check_options_validity(uint32_t arg_num, zend_long options)
|
|||
"LIBXML_NOERROR, "
|
||||
"LIBXML_COMPACT, "
|
||||
"LIBXML_HTML_NOIMPLIED, "
|
||||
"DOM\\NO_DEFAULT_NS)");
|
||||
"Dom\\NO_DEFAULT_NS)");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_HTMLDocument, createEmpty)
|
||||
PHP_METHOD(Dom_HTMLDocument, createEmpty)
|
||||
{
|
||||
const char *encoding = "UTF-8";
|
||||
size_t encoding_len = strlen("UTF-8");
|
||||
|
@ -775,7 +775,7 @@ static bool dom_should_register_error_handlers(zend_long options)
|
|||
return php_libxml_uses_internal_errors() || ((EG(error_reporting) | EG(user_error_handler_error_reporting)) & E_WARNING);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_HTMLDocument, createFromString)
|
||||
PHP_METHOD(Dom_HTMLDocument, createFromString)
|
||||
{
|
||||
const char *source, *override_encoding = NULL;
|
||||
size_t source_len, override_encoding_len;
|
||||
|
@ -926,7 +926,7 @@ fail_oom:
|
|||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_HTMLDocument, createFromFile)
|
||||
PHP_METHOD(Dom_HTMLDocument, createFromFile)
|
||||
{
|
||||
const char *filename, *override_encoding = NULL;
|
||||
php_dom_libxml_ns_mapper *ns_mapper = NULL;
|
||||
|
@ -1265,7 +1265,7 @@ static zend_result dom_common_save(dom_output_ctx *output_ctx, const xmlDoc *doc
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_HTMLDocument, saveHTMLFile)
|
||||
PHP_METHOD(Dom_HTMLDocument, saveHtmlFile)
|
||||
{
|
||||
zval *id;
|
||||
xmlDoc *docp;
|
||||
|
@ -1304,7 +1304,7 @@ PHP_METHOD(DOM_HTMLDocument, saveHTMLFile)
|
|||
RETURN_LONG(bytes);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_HTMLDocument, saveHTML)
|
||||
PHP_METHOD(Dom_HTMLDocument, saveHtml)
|
||||
{
|
||||
zval *nodep = NULL;
|
||||
const xmlDoc *docp;
|
||||
|
|
|
@ -1021,7 +1021,7 @@ PHP_METHOD(DOMNode, insertBefore)
|
|||
dom_node_insert_before(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, insertBefore)
|
||||
PHP_METHOD(Dom_Node, insertBefore)
|
||||
{
|
||||
dom_node_insert_before(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -1207,7 +1207,7 @@ PHP_METHOD(DOMNode, replaceChild)
|
|||
dom_node_replace_child(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, replaceChild)
|
||||
PHP_METHOD(Dom_Node, replaceChild)
|
||||
{
|
||||
dom_node_replace_child(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -1257,7 +1257,7 @@ PHP_METHOD(DOMNode, removeChild)
|
|||
dom_node_remove_child(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_node_class_entry);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, removeChild)
|
||||
PHP_METHOD(Dom_Node, removeChild)
|
||||
{
|
||||
dom_node_remove_child(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_modern_node_class_entry);
|
||||
}
|
||||
|
@ -1389,7 +1389,7 @@ PHP_METHOD(DOMNode, appendChild)
|
|||
dom_node_append_child_legacy(return_value, intern, childobj, nodep, child);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, appendChild)
|
||||
PHP_METHOD(Dom_Node, appendChild)
|
||||
{
|
||||
zval *node;
|
||||
xmlNodePtr nodep, child;
|
||||
|
@ -1580,7 +1580,7 @@ PHP_METHOD(DOMNode, isSameNode)
|
|||
dom_node_is_same_node(INTERNAL_FUNCTION_PARAM_PASSTHRU, node);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, isSameNode)
|
||||
PHP_METHOD(Dom_Node, isSameNode)
|
||||
{
|
||||
zval *node;
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O!", &node, dom_modern_node_class_entry) != SUCCESS) {
|
||||
|
@ -1780,7 +1780,7 @@ PHP_METHOD(DOMNode, isEqualNode)
|
|||
dom_node_is_equal_node_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, isEqualNode)
|
||||
PHP_METHOD(Dom_Node, isEqualNode)
|
||||
{
|
||||
dom_node_is_equal_node_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -1877,7 +1877,7 @@ PHP_METHOD(DOMNode, lookupPrefix)
|
|||
dom_node_lookup_prefix(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, lookupPrefix)
|
||||
PHP_METHOD(Dom_Node, lookupPrefix)
|
||||
{
|
||||
dom_node_lookup_prefix(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -1989,7 +1989,7 @@ PHP_METHOD(DOMNode, isDefaultNamespace)
|
|||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, isDefaultNamespace)
|
||||
PHP_METHOD(Dom_Node, isDefaultNamespace)
|
||||
{
|
||||
zval *id;
|
||||
xmlNodePtr nodep;
|
||||
|
@ -2291,7 +2291,7 @@ PHP_METHOD(DOMNode, getNodePath)
|
|||
dom_node_get_node_path(INTERNAL_FUNCTION_PARAM_PASSTHRU, false);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, getNodePath)
|
||||
PHP_METHOD(Dom_Node, getNodePath)
|
||||
{
|
||||
dom_node_get_node_path(INTERNAL_FUNCTION_PARAM_PASSTHRU, true);
|
||||
}
|
||||
|
@ -2354,7 +2354,7 @@ PHP_METHOD(DOMNode, contains)
|
|||
RETURN_BOOL(dom_node_contains(thisp, otherp));
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, contains)
|
||||
PHP_METHOD(Dom_Node, contains)
|
||||
{
|
||||
zval *other, *id;
|
||||
xmlNodePtr otherp, thisp;
|
||||
|
@ -2570,7 +2570,7 @@ PHP_METHOD(DOMNode, compareDocumentPosition)
|
|||
dom_node_compare_document_position(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_node_class_entry);
|
||||
}
|
||||
|
||||
PHP_METHOD(DOM_Node, compareDocumentPosition)
|
||||
PHP_METHOD(Dom_Node, compareDocumentPosition)
|
||||
{
|
||||
dom_node_compare_document_position(INTERNAL_FUNCTION_PARAM_PASSTHRU, dom_modern_node_class_entry);
|
||||
}
|
||||
|
@ -2585,7 +2585,7 @@ PHP_METHOD(DOM_Node, compareDocumentPosition)
|
|||
* - If the user implements __sleep / __wakeup, then it's also not a problem because they will not enter the throwing methods.
|
||||
*/
|
||||
|
||||
PHP_METHOD(DOM_Node, __construct)
|
||||
PHP_METHOD(Dom_Node, __construct)
|
||||
{
|
||||
ZEND_UNREACHABLE();
|
||||
}
|
||||
|
|
|
@ -521,7 +521,7 @@ static void dom_import_simplexml_common(INTERNAL_FUNCTION_PARAMETERS, php_libxml
|
|||
if (new_class == PHP_LIBXML_CLASS_MODERN) {
|
||||
zend_argument_type_error(1, "must not be already imported as a DOMNode");
|
||||
} else {
|
||||
zend_argument_type_error(1, "must not be already imported as a DOM\\Node");
|
||||
zend_argument_type_error(1, "must not be already imported as a Dom\\Node");
|
||||
}
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
@ -545,7 +545,7 @@ PHP_FUNCTION(dom_import_simplexml)
|
|||
dom_import_simplexml_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LIBXML_CLASS_LEGACY);
|
||||
}
|
||||
|
||||
PHP_FUNCTION(DOM_import_simplexml)
|
||||
PHP_FUNCTION(Dom_import_simplexml)
|
||||
{
|
||||
dom_import_simplexml_common(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_LIBXML_CLASS_MODERN);
|
||||
}
|
||||
|
@ -733,15 +733,15 @@ PHP_MINIT_FUNCTION(dom)
|
|||
dom_domexception_class_entry = register_class_DOMException(zend_ce_exception);
|
||||
|
||||
dom_parentnode_class_entry = register_class_DOMParentNode();
|
||||
dom_modern_parentnode_class_entry = register_class_DOM_ParentNode();
|
||||
dom_modern_parentnode_class_entry = register_class_Dom_ParentNode();
|
||||
dom_childnode_class_entry = register_class_DOMChildNode();
|
||||
dom_modern_childnode_class_entry = register_class_DOM_ChildNode();
|
||||
dom_modern_childnode_class_entry = register_class_Dom_ChildNode();
|
||||
|
||||
dom_domimplementation_class_entry = register_class_DOMImplementation();
|
||||
dom_domimplementation_class_entry->create_object = dom_objects_new;
|
||||
dom_domimplementation_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
dom_modern_domimplementation_class_entry = register_class_DOM_Implementation();
|
||||
dom_modern_domimplementation_class_entry = register_class_Dom_Implementation();
|
||||
dom_modern_domimplementation_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_domimplementation_class_entry->default_object_handlers = &dom_modern_domimplementation_object_handlers;
|
||||
|
||||
|
@ -770,7 +770,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
DOM_REGISTER_PROP_HANDLER(&dom_node_prop_handlers, "textContent", dom_node_text_content_read, dom_node_text_content_write);
|
||||
zend_hash_add_new_ptr(&classes, dom_node_class_entry->name, &dom_node_prop_handlers);
|
||||
|
||||
dom_modern_node_class_entry = register_class_DOM_Node();
|
||||
dom_modern_node_class_entry = register_class_Dom_Node();
|
||||
dom_modern_node_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_node_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -820,7 +820,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_documentfragment_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_documentfragment_class_entry->name, &dom_documentfragment_prop_handlers);
|
||||
|
||||
dom_modern_documentfragment_class_entry = register_class_DOM_DocumentFragment(dom_modern_node_class_entry, dom_modern_parentnode_class_entry);
|
||||
dom_modern_documentfragment_class_entry = register_class_Dom_DocumentFragment(dom_modern_node_class_entry, dom_modern_parentnode_class_entry);
|
||||
dom_modern_documentfragment_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_documentfragment_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_init(&dom_modern_documentfragment_prop_handlers, 0, NULL, NULL, true);
|
||||
|
@ -832,7 +832,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
DOM_OVERWRITE_PROP_HANDLER(&dom_modern_documentfragment_prop_handlers, "textContent", dom_node_text_content_read, dom_node_text_content_write);
|
||||
zend_hash_add_new_ptr(&classes, dom_modern_documentfragment_class_entry->name, &dom_modern_documentfragment_prop_handlers);
|
||||
|
||||
dom_abstract_base_document_class_entry = register_class_DOM_Document(dom_modern_node_class_entry, dom_modern_parentnode_class_entry);
|
||||
dom_abstract_base_document_class_entry = register_class_Dom_Document(dom_modern_node_class_entry, dom_modern_parentnode_class_entry);
|
||||
dom_abstract_base_document_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_init(&dom_abstract_base_document_prop_handlers, 0, NULL, NULL, true);
|
||||
DOM_REGISTER_PROP_HANDLER(&dom_abstract_base_document_prop_handlers, "implementation", dom_modern_document_implementation_read, NULL);
|
||||
|
@ -879,11 +879,11 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_document_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_document_class_entry->name, &dom_document_prop_handlers);
|
||||
|
||||
dom_html_document_class_entry = register_class_DOM_HTMLDocument(dom_abstract_base_document_class_entry);
|
||||
dom_html_document_class_entry = register_class_Dom_HTMLDocument(dom_abstract_base_document_class_entry);
|
||||
dom_html_document_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_add_new_ptr(&classes, dom_html_document_class_entry->name, &dom_abstract_base_document_prop_handlers);
|
||||
|
||||
dom_xml_document_class_entry = register_class_DOM_XMLDocument(dom_abstract_base_document_class_entry);
|
||||
dom_xml_document_class_entry = register_class_Dom_XMLDocument(dom_abstract_base_document_class_entry);
|
||||
dom_xml_document_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_init(&dom_xml_document_prop_handlers, 0, NULL, NULL, true);
|
||||
DOM_REGISTER_PROP_HANDLER(&dom_xml_document_prop_handlers, "xmlEncoding", dom_document_encoding_read, NULL);
|
||||
|
@ -903,7 +903,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
DOM_REGISTER_PROP_HANDLER(&dom_nodelist_prop_handlers, "length", dom_nodelist_length_read, NULL);
|
||||
zend_hash_add_new_ptr(&classes, dom_nodelist_class_entry->name, &dom_nodelist_prop_handlers);
|
||||
|
||||
dom_modern_nodelist_class_entry = register_class_DOM_NodeList(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_modern_nodelist_class_entry = register_class_Dom_NodeList(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_modern_nodelist_class_entry->create_object = dom_nnodemap_objects_new;
|
||||
dom_modern_nodelist_class_entry->default_object_handlers = &dom_modern_nodelist_object_handlers;
|
||||
dom_modern_nodelist_class_entry->get_iterator = php_dom_get_iterator;
|
||||
|
@ -919,21 +919,21 @@ PHP_MINIT_FUNCTION(dom)
|
|||
DOM_REGISTER_PROP_HANDLER(&dom_namednodemap_prop_handlers, "length", dom_namednodemap_length_read, NULL);
|
||||
zend_hash_add_new_ptr(&classes, dom_namednodemap_class_entry->name, &dom_namednodemap_prop_handlers);
|
||||
|
||||
dom_modern_namednodemap_class_entry = register_class_DOM_NamedNodeMap(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_modern_namednodemap_class_entry = register_class_Dom_NamedNodeMap(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_modern_namednodemap_class_entry->create_object = dom_nnodemap_objects_new;
|
||||
dom_modern_namednodemap_class_entry->default_object_handlers = &dom_modern_nnodemap_object_handlers;
|
||||
dom_modern_namednodemap_class_entry->get_iterator = php_dom_get_iterator;
|
||||
|
||||
zend_hash_add_new_ptr(&classes, dom_modern_namednodemap_class_entry->name, &dom_namednodemap_prop_handlers);
|
||||
|
||||
dom_modern_dtd_namednodemap_class_entry = register_class_DOM_DTDNamedNodeMap(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_modern_dtd_namednodemap_class_entry = register_class_Dom_DtdNamedNodeMap(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_modern_dtd_namednodemap_class_entry->create_object = dom_nnodemap_objects_new;
|
||||
dom_modern_dtd_namednodemap_class_entry->default_object_handlers = &dom_modern_nnodemap_object_handlers;
|
||||
dom_modern_dtd_namednodemap_class_entry->get_iterator = php_dom_get_iterator;
|
||||
|
||||
zend_hash_add_new_ptr(&classes, dom_modern_dtd_namednodemap_class_entry->name, &dom_namednodemap_prop_handlers);
|
||||
|
||||
dom_html_collection_class_entry = register_class_DOM_HTMLCollection(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_html_collection_class_entry = register_class_Dom_HTMLCollection(zend_ce_aggregate, zend_ce_countable);
|
||||
dom_html_collection_class_entry->create_object = dom_nnodemap_objects_new;
|
||||
dom_html_collection_class_entry->default_object_handlers = &dom_html_collection_object_handlers;
|
||||
dom_html_collection_class_entry->get_iterator = php_dom_get_iterator;
|
||||
|
@ -952,7 +952,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_characterdata_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_characterdata_class_entry->name, &dom_characterdata_prop_handlers);
|
||||
|
||||
dom_modern_characterdata_class_entry = register_class_DOM_CharacterData(dom_modern_node_class_entry, dom_modern_childnode_class_entry);
|
||||
dom_modern_characterdata_class_entry = register_class_Dom_CharacterData(dom_modern_node_class_entry, dom_modern_childnode_class_entry);
|
||||
dom_modern_characterdata_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_characterdata_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -979,7 +979,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_attr_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_attr_class_entry->name, &dom_attr_prop_handlers);
|
||||
|
||||
dom_modern_attr_class_entry = register_class_DOM_Attr(dom_modern_node_class_entry);
|
||||
dom_modern_attr_class_entry = register_class_Dom_Attr(dom_modern_node_class_entry);
|
||||
dom_modern_attr_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_attr_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1013,7 +1013,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_element_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_element_class_entry->name, &dom_element_prop_handlers);
|
||||
|
||||
dom_modern_element_class_entry = register_class_DOM_Element(dom_modern_node_class_entry, dom_modern_parentnode_class_entry, dom_modern_childnode_class_entry);
|
||||
dom_modern_element_class_entry = register_class_Dom_Element(dom_modern_node_class_entry, dom_modern_parentnode_class_entry, dom_modern_childnode_class_entry);
|
||||
dom_modern_element_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_element_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1043,7 +1043,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_text_prop_handlers, &dom_characterdata_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_text_class_entry->name, &dom_text_prop_handlers);
|
||||
|
||||
dom_modern_text_class_entry = register_class_DOM_Text(dom_modern_characterdata_class_entry);
|
||||
dom_modern_text_class_entry = register_class_Dom_Text(dom_modern_characterdata_class_entry);
|
||||
dom_modern_text_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_text_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1057,7 +1057,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
dom_comment_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_add_new_ptr(&classes, dom_comment_class_entry->name, &dom_characterdata_prop_handlers);
|
||||
|
||||
dom_modern_comment_class_entry = register_class_DOM_Comment(dom_modern_characterdata_class_entry);
|
||||
dom_modern_comment_class_entry = register_class_Dom_Comment(dom_modern_characterdata_class_entry);
|
||||
dom_modern_comment_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_comment_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_add_new_ptr(&classes, dom_modern_comment_class_entry->name, &dom_modern_characterdata_prop_handlers);
|
||||
|
@ -1067,7 +1067,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
dom_cdatasection_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_add_new_ptr(&classes, dom_cdatasection_class_entry->name, &dom_text_prop_handlers);
|
||||
|
||||
dom_modern_cdatasection_class_entry = register_class_DOM_CDATASection(dom_modern_text_class_entry);
|
||||
dom_modern_cdatasection_class_entry = register_class_Dom_CDATASection(dom_modern_text_class_entry);
|
||||
dom_modern_cdatasection_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_cdatasection_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
zend_hash_add_new_ptr(&classes, dom_modern_cdatasection_class_entry->name, &dom_modern_text_prop_handlers);
|
||||
|
@ -1086,7 +1086,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_documenttype_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_documenttype_class_entry->name, &dom_documenttype_prop_handlers);
|
||||
|
||||
dom_modern_documenttype_class_entry = register_class_DOM_DocumentType(dom_modern_node_class_entry, dom_modern_childnode_class_entry);
|
||||
dom_modern_documenttype_class_entry = register_class_Dom_DocumentType(dom_modern_node_class_entry, dom_modern_childnode_class_entry);
|
||||
dom_modern_documenttype_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_documenttype_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_notation_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_notation_class_entry->name, &dom_notation_prop_handlers);
|
||||
|
||||
dom_modern_notation_class_entry = register_class_DOM_Notation(dom_modern_node_class_entry);
|
||||
dom_modern_notation_class_entry = register_class_Dom_Notation(dom_modern_node_class_entry);
|
||||
dom_modern_notation_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_notation_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1134,7 +1134,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_entity_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_entity_class_entry->name, &dom_entity_prop_handlers);
|
||||
|
||||
dom_modern_entity_class_entry = register_class_DOM_Entity(dom_modern_node_class_entry);
|
||||
dom_modern_entity_class_entry = register_class_Dom_Entity(dom_modern_node_class_entry);
|
||||
dom_modern_entity_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_entity_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1157,7 +1157,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
DOM_OVERWRITE_PROP_HANDLER(&dom_entity_reference_prop_handlers, "childNodes", dom_entity_reference_child_nodes_read, NULL);
|
||||
zend_hash_add_new_ptr(&classes, dom_entityreference_class_entry->name, &dom_entity_reference_prop_handlers);
|
||||
|
||||
dom_modern_entityreference_class_entry = register_class_DOM_EntityReference(dom_modern_node_class_entry);
|
||||
dom_modern_entityreference_class_entry = register_class_Dom_EntityReference(dom_modern_node_class_entry);
|
||||
dom_modern_entityreference_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_entityreference_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1179,7 +1179,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
zend_hash_merge(&dom_processinginstruction_prop_handlers, &dom_node_prop_handlers, NULL, false);
|
||||
zend_hash_add_new_ptr(&classes, dom_processinginstruction_class_entry->name, &dom_processinginstruction_prop_handlers);
|
||||
|
||||
dom_modern_processinginstruction_class_entry = register_class_DOM_ProcessingInstruction(dom_modern_characterdata_class_entry);
|
||||
dom_modern_processinginstruction_class_entry = register_class_Dom_ProcessingInstruction(dom_modern_characterdata_class_entry);
|
||||
dom_modern_processinginstruction_class_entry->create_object = dom_objects_new;
|
||||
dom_modern_processinginstruction_class_entry->default_object_handlers = &dom_object_handlers;
|
||||
|
||||
|
@ -1205,7 +1205,7 @@ PHP_MINIT_FUNCTION(dom)
|
|||
DOM_REGISTER_PROP_HANDLER(&dom_xpath_prop_handlers, "registerNodeNamespaces", dom_xpath_register_node_ns_read, dom_xpath_register_node_ns_write);
|
||||
zend_hash_add_new_ptr(&classes, dom_xpath_class_entry->name, &dom_xpath_prop_handlers);
|
||||
|
||||
dom_modern_xpath_class_entry = register_class_DOM_XPath();
|
||||
dom_modern_xpath_class_entry = register_class_Dom_XPath();
|
||||
dom_modern_xpath_class_entry->create_object = dom_xpath_objects_new;
|
||||
dom_modern_xpath_class_entry->default_object_handlers = &dom_xpath_object_handlers;
|
||||
|
||||
|
|
|
@ -889,7 +889,7 @@ namespace
|
|||
public function replaceChildren(...$nodes): void {}
|
||||
}
|
||||
|
||||
/** @alias DOM\DOMException */
|
||||
/** @alias Dom\DOMException */
|
||||
final class DOMException extends Exception
|
||||
{
|
||||
/**
|
||||
|
@ -1025,7 +1025,7 @@ namespace
|
|||
function dom_import_simplexml(object $node): DOMElement {}
|
||||
}
|
||||
|
||||
namespace DOM
|
||||
namespace Dom
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
|
@ -1252,7 +1252,7 @@ namespace DOM
|
|||
public function getIterator(): \Iterator {}
|
||||
}
|
||||
|
||||
class DTDNamedNodeMap implements \IteratorAggregate, \Countable
|
||||
class DtdNamedNodeMap implements \IteratorAggregate, \Countable
|
||||
{
|
||||
/** @readonly */
|
||||
public int $length;
|
||||
|
@ -1330,7 +1330,7 @@ namespace DOM
|
|||
public function getAttributeNode(string $qualifiedName): ?Attr {}
|
||||
/** @implementation-alias DOMElement::getAttributeNodeNS */
|
||||
public function getAttributeNodeNS(?string $namespace, string $localName): ?Attr {}
|
||||
/** @implementation-alias DOM\Element::setAttributeNodeNS */
|
||||
/** @implementation-alias Dom\Element::setAttributeNodeNS */
|
||||
public function setAttributeNode(Attr $attr) : ?Attr {}
|
||||
public function setAttributeNodeNS(Attr $attr) : ?Attr {}
|
||||
public function removeAttributeNode(Attr $attr) : Attr {}
|
||||
|
@ -1452,9 +1452,9 @@ namespace DOM
|
|||
/** @readonly */
|
||||
public string $name;
|
||||
/** @readonly */
|
||||
public DTDNamedNodeMap $entities;
|
||||
public DtdNamedNodeMap $entities;
|
||||
/** @readonly */
|
||||
public DTDNamedNodeMap $notations;
|
||||
public DtdNamedNodeMap $notations;
|
||||
/** @readonly */
|
||||
public string $publicId;
|
||||
/** @readonly */
|
||||
|
@ -1482,7 +1482,7 @@ namespace DOM
|
|||
public int $childElementCount;
|
||||
|
||||
/** @implementation-alias DOMDocumentFragment::appendXML */
|
||||
public function appendXML(string $data): bool {}
|
||||
public function appendXml(string $data): bool {}
|
||||
/** @implementation-alias DOMElement::append */
|
||||
public function append(Node|string ...$nodes): void {}
|
||||
/** @implementation-alias DOMElement::prepend */
|
||||
|
@ -1525,9 +1525,9 @@ namespace DOM
|
|||
public ?DocumentType $doctype;
|
||||
/** @readonly */
|
||||
public ?Element $documentElement;
|
||||
/** @implementation-alias DOM\Element::getElementsByTagName */
|
||||
/** @implementation-alias Dom\Element::getElementsByTagName */
|
||||
public function getElementsByTagName(string $qualifiedName): HTMLCollection {}
|
||||
/** @implementation-alias DOM\Element::getElementsByTagNameNS */
|
||||
/** @implementation-alias Dom\Element::getElementsByTagNameNS */
|
||||
public function getElementsByTagNameNS(?string $namespace, string $localName): HTMLCollection {}
|
||||
|
||||
public function createElement(string $localName): Element {}
|
||||
|
@ -1568,9 +1568,9 @@ namespace DOM
|
|||
/** @implementation-alias DOMDocument::schemaValidateSource */
|
||||
public function schemaValidateSource(string $source, int $flags = 0): bool {}
|
||||
/** @implementation-alias DOMDocument::relaxNGValidate */
|
||||
public function relaxNGValidate(string $filename): bool {}
|
||||
public function relaxNgValidate(string $filename): bool {}
|
||||
/** @implementation-alias DOMDocument::relaxNGValidateSource */
|
||||
public function relaxNGValidateSource(string $source): bool {}
|
||||
public function relaxNgValidateSource(string $source): bool {}
|
||||
#endif
|
||||
|
||||
/** @implementation-alias DOMElement::append */
|
||||
|
@ -1591,15 +1591,15 @@ namespace DOM
|
|||
|
||||
public static function createFromString(string $source, int $options = 0, ?string $overrideEncoding = null): HTMLDocument {}
|
||||
|
||||
/** @implementation-alias DOM\XMLDocument::saveXML */
|
||||
public function saveXML(?Node $node = null, int $options = 0): string|false {}
|
||||
/** @implementation-alias Dom\XMLDocument::saveXml */
|
||||
public function saveXml(?Node $node = null, int $options = 0): string|false {}
|
||||
|
||||
/** @implementation-alias DOMDocument::save */
|
||||
public function saveXMLFile(string $filename, int $options = 0): int|false {}
|
||||
public function saveXmlFile(string $filename, int $options = 0): int|false {}
|
||||
|
||||
public function saveHTML(?Node $node = null): string {}
|
||||
public function saveHtml(?Node $node = null): string {}
|
||||
|
||||
public function saveHTMLFile(string $filename): int|false {}
|
||||
public function saveHtmlFile(string $filename): int|false {}
|
||||
}
|
||||
|
||||
final class XMLDocument extends Document
|
||||
|
@ -1628,10 +1628,10 @@ namespace DOM
|
|||
/** @implementation-alias DOMDocument::xinclude */
|
||||
public function xinclude(int $options = 0): int|false {}
|
||||
|
||||
public function saveXML(?Node $node = null, int $options = 0): string|false {}
|
||||
public function saveXml(?Node $node = null, int $options = 0): string|false {}
|
||||
|
||||
/** @implementation-alias DOMDocument::save */
|
||||
public function saveXMLFile(string $filename, int $options = 0): int|false {}
|
||||
public function saveXmlFile(string $filename, int $options = 0): int|false {}
|
||||
}
|
||||
|
||||
#ifdef LIBXML_XPATH_ENABLED
|
||||
|
|
1036
ext/dom/php_dom_arginfo.h
generated
1036
ext/dom/php_dom_arginfo.h
generated
File diff suppressed because it is too large
Load diff
|
@ -15,7 +15,7 @@ print $dom->ownerDocument->saveXML();
|
|||
|
||||
// This should fail because it has been imported already above in legacy DOM
|
||||
try {
|
||||
DOM\import_simplexml($s);
|
||||
Dom\import_simplexml($s);
|
||||
} catch (TypeError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
@ -32,4 +32,4 @@ try {
|
|||
<author>John Steinbeck</author>
|
||||
</book>
|
||||
</books>
|
||||
DOM\import_simplexml(): Argument #1 ($node) must not be already imported as a DOMNode
|
||||
Dom\import_simplexml(): Argument #1 ($node) must not be already imported as a DOMNode
|
||||
|
|
|
@ -6,7 +6,7 @@ dom
|
|||
<?php
|
||||
|
||||
foreach (['firstChild', 'lastChild', 'textContent', 'childNodes'] as $prop) {
|
||||
$dom = DOM\XMLDocument::createFromString(<<<XML
|
||||
$dom = Dom\XMLDocument::createFromString(<<<XML
|
||||
<!DOCTYPE foo [
|
||||
<!ENTITY foo "bar">
|
||||
]>
|
||||
|
@ -28,7 +28,7 @@ foreach (['firstChild', 'lastChild', 'textContent', 'childNodes'] as $prop) {
|
|||
NULL
|
||||
NULL
|
||||
NULL
|
||||
object(DOM\NodeList)#1 (1) {
|
||||
object(Dom\NodeList)#1 (1) {
|
||||
["length"]=>
|
||||
int(0)
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ function createTestDoc(DomType $type) {
|
|||
$doc->preserveWhiteSpace = false;
|
||||
$doc->loadXML($xml);
|
||||
} else {
|
||||
$doc = DOM\XMLDocument::createFromString($xml, LIBXML_NOBLANKS);
|
||||
$doc = Dom\XMLDocument::createFromString($xml, LIBXML_NOBLANKS);
|
||||
}
|
||||
|
||||
return $doc;
|
||||
|
|
|
@ -5,7 +5,7 @@ dom
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = DOM\XMLDocument::createFromString(<<<XML
|
||||
$xml = Dom\XMLDocument::createFromString(<<<XML
|
||||
<!DOCTYPE root [
|
||||
<!ENTITY foo "foo">
|
||||
]>
|
||||
|
@ -13,11 +13,11 @@ $xml = DOM\XMLDocument::createFromString(<<<XML
|
|||
XML);
|
||||
|
||||
$el = $xml->documentElement->firstChild;
|
||||
echo $xml->saveXML(), "\n";
|
||||
echo $xml->saveXml(), "\n";
|
||||
|
||||
$html = DOM\HTMLDocument::createEmpty();
|
||||
$html = Dom\HTMLDocument::createEmpty();
|
||||
$html->append($html->importNode($el, true));
|
||||
echo $html->saveHTML(), "\n";
|
||||
echo $html->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument GB18030 encoding test
|
||||
Dom\HTMLDocument GB18030 encoding test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/gb18030.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/gb18030.html");
|
||||
var_dump($dom->charset);
|
||||
$dom->documentElement->firstChild->nextElementSibling->textContent = "é";
|
||||
$output = $dom->saveHTML();
|
||||
$output = $dom->saveHtml();
|
||||
echo $output, "\n";
|
||||
$dom->saveHTMLFile(__DIR__ . "/gb18030_output.tmp");
|
||||
$dom->saveHtmlFile(__DIR__ . "/gb18030_output.tmp");
|
||||
var_dump(file_get_contents(__DIR__ . "/gb18030_output.tmp") === $output);
|
||||
|
||||
echo "--- After changing encoding to UTF-8 ---\n";
|
||||
$dom->charset = "UTF-8";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument Shift JIS encoding test
|
||||
Dom\HTMLDocument Shift JIS encoding test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/shift_jis.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/shift_jis.html");
|
||||
var_dump($dom->charset);
|
||||
$dom->documentElement->firstChild->nextElementSibling->textContent .= "é";
|
||||
$output = $dom->saveHTML();
|
||||
$output = $dom->saveHtml();
|
||||
echo $output, "\n";
|
||||
$dom->saveHTMLFile(__DIR__ . "/shift_jis.tmp");
|
||||
$dom->saveHtmlFile(__DIR__ . "/shift_jis.tmp");
|
||||
var_dump(file_get_contents(__DIR__ . "/shift_jis.tmp") === $output);
|
||||
|
||||
echo "--- After changing encoding to UTF-8 ---\n";
|
||||
$dom->charset = "UTF-8";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument UTF-16BE BOM encoding test
|
||||
Dom\HTMLDocument UTF-16BE BOM encoding test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/utf16be_bom.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/utf16be_bom.html");
|
||||
var_dump($dom->characterSet);
|
||||
$dom->documentElement->firstChild->nextElementSibling->textContent = "é";
|
||||
$output = $dom->saveHTML();
|
||||
$output = $dom->saveHtml();
|
||||
echo $output, "\n";
|
||||
$dom->saveHTMLFile(__DIR__ . "/utf16be_bom_output.tmp");
|
||||
$dom->saveHtmlFile(__DIR__ . "/utf16be_bom_output.tmp");
|
||||
var_dump(file_get_contents(__DIR__ . "/utf16be_bom_output.tmp") === $output);
|
||||
|
||||
echo "--- After changing encoding to UTF-8 ---\n";
|
||||
$dom->characterSet = "UTF-8";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument UTF-16LE BOM encoding test
|
||||
Dom\HTMLDocument UTF-16LE BOM encoding test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/utf16le_bom.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/utf16le_bom.html");
|
||||
var_dump($dom->inputEncoding);
|
||||
$dom->documentElement->firstChild->nextElementSibling->textContent = "é";
|
||||
$output = $dom->saveHTML();
|
||||
$output = $dom->saveHtml();
|
||||
echo $output, "\n";
|
||||
$dom->saveHTMLFile(__DIR__ . "/utf16le_bom_output.tmp");
|
||||
$dom->saveHtmlFile(__DIR__ . "/utf16le_bom_output.tmp");
|
||||
var_dump(file_get_contents(__DIR__ . "/utf16le_bom_output.tmp") === $output);
|
||||
|
||||
echo "--- After changing encoding to UTF-8 ---\n";
|
||||
$dom->inputEncoding = "UTF-8";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument UTF-8 BOM encoding test
|
||||
Dom\HTMLDocument UTF-8 BOM encoding test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/utf8_bom.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/utf8_bom.html");
|
||||
var_dump($dom->charset);
|
||||
$dom->documentElement->firstChild->nextElementSibling->textContent = "é";
|
||||
$output = $dom->saveHTML();
|
||||
$output = $dom->saveHtml();
|
||||
echo $output, "\n";
|
||||
$dom->saveHTMLFile(__DIR__ . "/utf8_bom_output.tmp");
|
||||
$dom->saveHtmlFile(__DIR__ . "/utf8_bom_output.tmp");
|
||||
var_dump(file_get_contents(__DIR__ . "/utf8_bom_output.tmp") === $output);
|
||||
|
||||
echo "--- After changing encoding to UTF-8 ---\n";
|
||||
$dom->charset = "UTF-8";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument Windows-1251 encoding test
|
||||
Dom\HTMLDocument Windows-1251 encoding test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/windows1251.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/windows1251.html");
|
||||
var_dump($dom->charset);
|
||||
$dom->documentElement->firstChild->nextElementSibling->textContent .= "é"; // Note: won't show up in Windows 1251 because it doesn't exist there
|
||||
$output = $dom->saveHTML();
|
||||
$output = $dom->saveHtml();
|
||||
echo $output, "\n";
|
||||
$dom->saveHTMLFile(__DIR__ . "/windows1251_output.tmp");
|
||||
$dom->saveHtmlFile(__DIR__ . "/windows1251_output.tmp");
|
||||
var_dump(file_get_contents(__DIR__ . "/windows1251_output.tmp") === $output);
|
||||
|
||||
echo "--- After changing encoding to UTF-8 ---\n";
|
||||
$dom->charset = "UTF-8";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() HTTP header Content-Type
|
||||
Dom\HTMLDocument::createFromFile() HTTP header Content-Type
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--SKIPIF--
|
||||
|
@ -62,7 +62,7 @@ foreach ($tests as $name => $headers) {
|
|||
$responses = array_map(fn ($header) => "data://text/plain,HTTP/1.1 200 OK\r\nContent-Type: " . $header . "\r\n\r\n" . "<p>\xE4\xF6\xFC</p>\n", $headers);
|
||||
['pid' => $pid, 'uri' => $uri] = http_server($responses);
|
||||
for ($i = 0; $i < count($responses); $i++) {
|
||||
$result = DOM\HTMLDocument::createFromFile($uri, LIBXML_NOERROR);
|
||||
$result = Dom\HTMLDocument::createFromFile($uri, LIBXML_NOERROR);
|
||||
echo $result->getElementsByTagName("p")[0]->textContent, "\n";
|
||||
}
|
||||
http_server_kill($pid);
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() with overrideEncoding
|
||||
Dom\HTMLDocument::createFromFile() with overrideEncoding
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
DOM\HTMLDocument::createFromFile(__DIR__ . '/gb18030_without_charset.html', overrideEncoding: 'nonexistent');
|
||||
Dom\HTMLDocument::createFromFile(__DIR__ . '/gb18030_without_charset.html', overrideEncoding: 'nonexistent');
|
||||
} catch (ValueError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
// The override encoding matches with the document encoding attribute
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . '/gb18030_without_charset.html', overrideEncoding: 'GB18030');
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . '/gb18030_without_charset.html', overrideEncoding: 'GB18030');
|
||||
var_dump($dom->documentElement->lastChild->textContent);
|
||||
var_dump($dom->charset);
|
||||
|
||||
// The override encoding mismatches with the document encoding attribute
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . '/fallback_encoding.html', overrideEncoding: 'Windows-1252');
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . '/fallback_encoding.html', overrideEncoding: 'Windows-1252');
|
||||
var_dump($dom->documentElement->lastChild->textContent);
|
||||
var_dump($dom->charset);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
DOM\HTMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding
|
||||
Dom\HTMLDocument::createFromFile(): Argument #3 ($overrideEncoding) must be a valid document encoding
|
||||
string(20) "
|
||||
Héllo, world!
|
||||
"
|
||||
|
|
|
@ -1,29 +1,29 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() with overrideEncoding
|
||||
Dom\HTMLDocument::createFromString() with overrideEncoding
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
DOM\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/gb18030_without_charset.html'), overrideEncoding: 'nonexistent');
|
||||
Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/gb18030_without_charset.html'), overrideEncoding: 'nonexistent');
|
||||
} catch (ValueError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
// The override encoding matches with the document encoding attribute
|
||||
$dom = DOM\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/gb18030_without_charset.html'), overrideEncoding: 'GB18030');
|
||||
$dom = Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/gb18030_without_charset.html'), overrideEncoding: 'GB18030');
|
||||
var_dump($dom->documentElement->lastChild->textContent);
|
||||
var_dump($dom->charset);
|
||||
|
||||
// The override encoding mismatches with the document encoding attribute
|
||||
$dom = DOM\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/fallback_encoding.html'), overrideEncoding: 'Windows-1252');
|
||||
$dom = Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . '/fallback_encoding.html'), overrideEncoding: 'Windows-1252');
|
||||
var_dump($dom->documentElement->lastChild->textContent);
|
||||
var_dump($dom->charset);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
DOM\HTMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding
|
||||
Dom\HTMLDocument::createFromString(): Argument #3 ($overrideEncoding) must be a valid document encoding
|
||||
string(20) "
|
||||
Héllo, world!
|
||||
"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument edge case encoding 01
|
||||
Dom\HTMLDocument edge case encoding 01
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -7,11 +7,11 @@ dom
|
|||
|
||||
// UTF-8 -> UTF-8
|
||||
// Create a UTF-8 string where a UTF-8 byte sequence falls over the boundary of the 4096 byte buffer
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$element = $dom->createElement("container");
|
||||
$dom->append($element);
|
||||
$element->append(str_repeat("A", 4096 - 2 - strlen("<container>")) . "\xf0\x90\x8d\x88AA");
|
||||
var_dump($dom->saveHTML());
|
||||
var_dump($dom->saveHtml());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument edge case encoding 02
|
||||
Dom\HTMLDocument edge case encoding 02
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// UTF-8 -> GB18030
|
||||
$dom = DOM\HTMLDocument::createEmpty("GB18030");
|
||||
$dom = Dom\HTMLDocument::createEmpty("GB18030");
|
||||
$element = $dom->createElement("container");
|
||||
$dom->append($element);
|
||||
// Create a UTF-8 string where a UTF-8 byte sequence falls over the boundary of the 4096 byte buffer
|
||||
// *and* the sequence also falls over the boundary for the result
|
||||
$element->append(str_repeat("A", 4096 - 2 - strlen("<container>")) . "\xf0\x90\x8d\x88AA");
|
||||
var_dump($output = $dom->saveHTML());
|
||||
var_dump($output = $dom->saveHtml());
|
||||
|
||||
// GB18030 encoding of the above UTF-8 symbol
|
||||
var_dump($output[4094] == "\x90");
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument edge case encoding 03
|
||||
Dom\HTMLDocument edge case encoding 03
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// UTF-8 -> GB18030
|
||||
$dom = DOM\HTMLDocument::createEmpty("GB18030");
|
||||
$dom = Dom\HTMLDocument::createEmpty("GB18030");
|
||||
$element = $dom->createElement("container");
|
||||
$dom->append($element);
|
||||
// Create a UTF-8 string where an invalid UTF-8 byte sequence falls over the boundary of the 4096 byte buffer
|
||||
// Note: the strange ?1?7 sequence is the GB18030 encoding for the unicode replacement character
|
||||
$element->append(str_repeat("A", 4096 - 2 - strlen("<container>")) . "\xff\xff\xff");
|
||||
var_dump($dom->saveHTML());
|
||||
var_dump($dom->saveHtml());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument edge case encoding 04
|
||||
Dom\HTMLDocument edge case encoding 04
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// UTF-8 -> UTF-8
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$element = $dom->createElement("container");
|
||||
$dom->append($element);
|
||||
// Create a UTF-8 string where an invalid UTF-8 byte sequence falls over the boundary of the 4096 byte buffer
|
||||
$element->append(str_repeat("A", 4096 - 2 - strlen("<container>")) . "\xff\xff\xff");
|
||||
var_dump($dom->saveHTML());
|
||||
var_dump($dom->saveHtml());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument edge case encoding 05
|
||||
Dom\HTMLDocument edge case encoding 05
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -9,11 +9,11 @@ dom
|
|||
$header = "<!doctype html><html><head><meta charset=\"gb18030\"></head><body>";
|
||||
$padding_required_until_4094 = 4094 - strlen($header);
|
||||
$trailer = "\x90\x30\xd5\x30";
|
||||
$dom = DOM\HTMLDocument::createFromString($header . str_repeat("A", $padding_required_until_4094) . $trailer);
|
||||
$dom = Dom\HTMLDocument::createFromString($header . str_repeat("A", $padding_required_until_4094) . $trailer);
|
||||
// GB18030 byte sequence crossing the 4096 boundary
|
||||
var_dump($dom->charset);
|
||||
$dom->charset = "UTF-8";
|
||||
var_dump($dom->saveHTML());
|
||||
var_dump($dom->saveHtml());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument edge case encoding 06
|
||||
Dom\HTMLDocument edge case encoding 06
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// UTF-8 -> UTF-8
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$element = $dom->createElement("container");
|
||||
$dom->append($element);
|
||||
// Create a UTF-8 string where a *broken* UTF-8 byte sequence falls over the boundary of the 4096 byte buffer
|
||||
$element->append(str_repeat("A", 4096 - 1 - strlen("<container>")) . "\xf0\x90");
|
||||
var_dump($dom->saveHTML());
|
||||
var_dump($dom->saveHtml());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument edge case encoding 07
|
||||
Dom\HTMLDocument edge case encoding 07
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -9,11 +9,11 @@ dom
|
|||
$header = "<!doctype html><html><head><meta charset=\"gb18030\"></head><body>";
|
||||
$padding_required_until_4095 = 4095 - strlen($header);
|
||||
$trailer = "\x90\x30";
|
||||
$dom = DOM\HTMLDocument::createFromString($header . str_repeat("A", $padding_required_until_4095) . $trailer);
|
||||
$dom = Dom\HTMLDocument::createFromString($header . str_repeat("A", $padding_required_until_4095) . $trailer);
|
||||
// GB18030 *broken* byte sequence crossing the 4096 boundary
|
||||
var_dump($dom->charset);
|
||||
$dom->charset = "UTF-8";
|
||||
var_dump($dom->saveHTML());
|
||||
var_dump($dom->saveHtml());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument test values for encoding field
|
||||
Dom\HTMLDocument test values for encoding field
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
var_dump($dom->charset);
|
||||
$dom->inputEncoding = "CSeuckr";
|
||||
var_dump($dom->characterSet);
|
||||
|
@ -23,10 +23,10 @@ try {
|
|||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
var_dump($dom->inputEncoding);
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
try {
|
||||
$dom = DOM\HTMLDocument::createEmpty("bogus");
|
||||
$dom = Dom\HTMLDocument::createEmpty("bogus");
|
||||
} catch (ValueError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
@ -40,4 +40,4 @@ string(6) "EUC-KR"
|
|||
string(12) "windows-1251"
|
||||
Invalid document encoding
|
||||
string(12) "windows-1251"
|
||||
DOM\HTMLDocument::createEmpty(): Argument #1 ($encoding) must be a valid document encoding
|
||||
Dom\HTMLDocument::createEmpty(): Argument #1 ($encoding) must be a valid document encoding
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument loading with unicode codepoints resulting in an error
|
||||
Dom\HTMLDocument loading with unicode codepoints resulting in an error
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
echo "--- createFromFile ---\n";
|
||||
DOM\HTMLDocument::createFromFile(__DIR__."/utf16le_error.html");
|
||||
Dom\HTMLDocument::createFromFile(__DIR__."/utf16le_error.html");
|
||||
echo "--- createFromString ---\n";
|
||||
DOM\HTMLDocument::createFromString(file_get_contents(__DIR__."/utf16le_error.html"));
|
||||
Dom\HTMLDocument::createFromString(file_get_contents(__DIR__."/utf16le_error.html"));
|
||||
?>
|
||||
--EXPECTF--
|
||||
--- createFromFile ---
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromFile(): tokenizer error missing-end-tag-name in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromFile(): tokenizer error missing-end-tag-name in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromFile(): tree error unexpected-token in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromFile(): tree error unexpected-token in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromFile(): tree error unexpected-token in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromFile(): tree error unexpected-token in %s on line %d
|
||||
--- createFromString ---
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tokenizer error missing-end-tag-name in Entity, line: 7, column: 29 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tokenizer error missing-end-tag-name in Entity, line: 7, column: 29 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tree error unexpected-token in Entity, line: 7, column: 14-17 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-token in Entity, line: 7, column: 14-17 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tree error unexpected-token in Entity, line: 8, column: 7-10 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-token in Entity, line: 8, column: 7-10 in %s on line %d
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument fallback encoding test
|
||||
Dom\HTMLDocument fallback encoding test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/fallback_encoding.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/fallback_encoding.html");
|
||||
var_dump($dom->inputEncoding);
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--CLEAN--
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument: overrideEncoding with incompatible charset
|
||||
Dom\HTMLDocument: overrideEncoding with incompatible charset
|
||||
--EXTENSIONS--
|
||||
iconv
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
$doc = DOM\HTMLDocument::createFromString(
|
||||
$doc = Dom\HTMLDocument::createFromString(
|
||||
iconv(
|
||||
'ISO-8859-1',
|
||||
'UTF-8',
|
||||
|
@ -14,10 +14,10 @@ $doc = DOM\HTMLDocument::createFromString(
|
|||
<html>
|
||||
<head>
|
||||
<meta charset="iso-8859-1">
|
||||
<title>äöü</title>
|
||||
<title><EFBFBD><EFBFBD><EFBFBD></title>
|
||||
</head>
|
||||
<body>
|
||||
äöü
|
||||
<EFBFBD><EFBFBD><EFBFBD>
|
||||
</body>
|
||||
</html>
|
||||
DOC,
|
||||
|
@ -29,8 +29,8 @@ var_dump(iconv('UTF-8', 'ISO-8859-1', $doc->getElementsByTagName('title')->item(
|
|||
var_dump(iconv('UTF-8', 'ISO-8859-1', $doc->getElementsByTagName('body')->item(0)->textContent));
|
||||
?>
|
||||
--EXPECT--
|
||||
string(3) "äöü"
|
||||
string(9) "
|
||||
äöü
|
||||
string(9) "<22><><EFBFBD>"
|
||||
string(15) "
|
||||
<EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
"
|
||||
|
|
|
@ -5,7 +5,7 @@ dom
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\XMLDocument::createFromString('<root/>');
|
||||
$dom = Dom\XMLDocument::createFromString('<root/>');
|
||||
|
||||
try {
|
||||
$dom->getElementsByTagName('root')[][1] = 1;
|
||||
|
@ -27,6 +27,6 @@ try {
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
Cannot append to DOM\HTMLCollection
|
||||
Cannot access offset of type bool on DOM\HTMLCollection
|
||||
Cannot append to Dom\HTMLCollection
|
||||
Cannot access offset of type bool on Dom\HTMLCollection
|
||||
Cannot access offset of type bool in isset or empty
|
||||
|
|
|
@ -21,7 +21,7 @@ $xml = <<<XML
|
|||
</root>
|
||||
XML;
|
||||
|
||||
$dom = DOM\XMLDocument::createFromString($xml);
|
||||
$dom = Dom\XMLDocument::createFromString($xml);
|
||||
|
||||
function test($obj, $name) {
|
||||
echo "--- Query \"$name\" ---\n";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
Cloning a DOM\HTMLDocument
|
||||
Cloning a Dom\HTMLDocument
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p>foo</p>");
|
||||
$dom = Dom\HTMLDocument::createFromString("<p>foo</p>");
|
||||
|
||||
$dom2 = clone $dom;
|
||||
var_dump($dom2->firstChild->tagName);
|
||||
|
@ -17,7 +17,7 @@ var_dump(get_class($element->ownerDocument));
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DOM\HTMLDocument::createFromString(): tree error unexpected-token-in-initial-mode in Entity, line: 1, column: 2 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-token-in-initial-mode in Entity, line: 1, column: 2 in %s on line %d
|
||||
string(4) "HTML"
|
||||
string(3) "foo"
|
||||
string(16) "DOM\HTMLDocument"
|
||||
string(16) "Dom\HTMLDocument"
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::documentURI
|
||||
Dom\HTMLDocument::documentURI
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/test foo.html", LIBXML_NOERROR);
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/test foo.html", LIBXML_NOERROR);
|
||||
var_dump($dom->documentURI);
|
||||
|
||||
$memory = fopen("php://memory", "w+");
|
||||
fwrite($memory, "foobar");
|
||||
rewind($memory);
|
||||
$dom = DOM\HTMLDocument::createFromFile("php://memory");
|
||||
$dom = Dom\HTMLDocument::createFromFile("php://memory");
|
||||
var_dump($dom->documentURI);
|
||||
fclose($memory);
|
||||
|
||||
|
@ -37,7 +37,7 @@ class DummyWrapper {
|
|||
|
||||
stream_wrapper_register("dummy", DummyWrapper::class);
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile("dummy://foo/ bar");
|
||||
$dom = Dom\HTMLDocument::createFromFile("dummy://foo/ bar");
|
||||
var_dump($dom->documentURI);
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
Test DOM\HTMLDocument::getElementsByTagName(NS)
|
||||
Test Dom\HTMLDocument::getElementsByTagName(NS)
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::registerNodeClass 01
|
||||
Dom\HTMLDocument::registerNodeClass 01
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = new DOMDocument();
|
||||
$dom->registerNodeClass("DOM\\HTMLDocument", "DOMDocument");
|
||||
$dom->registerNodeClass("Dom\\HTMLDocument", "DOMDocument");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught TypeError: DOMDocument::registerNodeClass(): Argument #1 ($baseClass) must be a class name derived from DOMNode, DOM\HTMLDocument given in %s:%d
|
||||
Fatal error: Uncaught TypeError: DOMDocument::registerNodeClass(): Argument #1 ($baseClass) must be a class name derived from DOMNode, Dom\HTMLDocument given in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): DOMDocument->registerNodeClass('DOM\\HTMLDocumen...', 'DOMDocument')
|
||||
#0 %s(%d): DOMDocument->registerNodeClass('Dom\\HTMLDocumen...', 'DOMDocument')
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::registerNodeClass 02
|
||||
Dom\HTMLDocument::registerNodeClass 02
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Custom extends DOM\Document {
|
||||
class Custom extends Dom\Document {
|
||||
public function foo() {
|
||||
}
|
||||
}
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
try {
|
||||
$dom->registerNodeClass("DOM\\Document", "Custom");
|
||||
$dom->registerNodeClass("Dom\\Document", "Custom");
|
||||
} catch (ValueError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ $element->ownerDocument->foo();
|
|||
|
||||
?>
|
||||
--EXPECTF--
|
||||
DOM\Document::registerNodeClass(): Argument #1 ($baseClass) must not be an abstract class
|
||||
string(16) "DOM\HTMLDocument"
|
||||
Dom\Document::registerNodeClass(): Argument #1 ($baseClass) must not be an abstract class
|
||||
string(16) "Dom\HTMLDocument"
|
||||
|
||||
Fatal error: Uncaught Error: Call to undefined method DOM\HTMLDocument::foo() in %s:%d
|
||||
Fatal error: Uncaught Error: Call to undefined method Dom\HTMLDocument::foo() in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::registerNodeClass 03
|
||||
Dom\HTMLDocument::registerNodeClass 03
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class Custom extends DOM\Element {
|
||||
class Custom extends Dom\Element {
|
||||
public int $test = 1;
|
||||
|
||||
public function reverseTagName(): string {
|
||||
|
@ -14,8 +14,8 @@ class Custom extends DOM\Element {
|
|||
}
|
||||
}
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<div>foo</div>", LIBXML_NOERROR);
|
||||
$dom->registerNodeClass("DOM\\Element", "Custom");
|
||||
$dom = Dom\HTMLDocument::createFromString("<div>foo</div>", LIBXML_NOERROR);
|
||||
$dom->registerNodeClass("Dom\\Element", "Custom");
|
||||
|
||||
var_dump($dom->getElementsByTagName('div')[0]->reverseTagName());
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::saveHTMLFile() empty path
|
||||
Dom\HTMLDocument::saveHtmlFile() empty path
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$root = $dom->appendChild($dom->createElement("root"));
|
||||
$dom->saveHTMLFile("");
|
||||
$dom->saveHtmlFile("");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught ValueError: DOM\HTMLDocument::saveHTMLFile(): Argument #1 ($filename) must not be empty in %s:%d
|
||||
Fatal error: Uncaught ValueError: Dom\HTMLDocument::saveHtmlFile(): Argument #1 ($filename) must not be empty in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): DOM\HTMLDocument->saveHTMLFile('')
|
||||
#0 %s(%d): Dom\HTMLDocument->saveHtmlFile('')
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::saveHTML() wrong document
|
||||
Dom\HTMLDocument::saveHtml() wrong document
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom->saveHTML(DOM\HTMLDocument::createEmpty());
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$dom->saveHtml(Dom\HTMLDocument::createEmpty());
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught DOMException: Wrong Document Error in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): DOM\HTMLDocument->saveHTML(Object(DOM\HTMLDocument))
|
||||
#0 %s(%d): Dom\HTMLDocument->saveHtml(Object(Dom\HTMLDocument))
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument should retain properties and ownerDocument relation 01
|
||||
Dom\HTMLDocument should retain properties and ownerDocument relation 01
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class MyElement extends DOM\Element {}
|
||||
class MyElement extends Dom\Element {}
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p>foo</p>", LIBXML_NOERROR);
|
||||
$dom->registerNodeClass("DOM\\Element", "MyElement");
|
||||
$dom = Dom\HTMLDocument::createFromString("<p>foo</p>", LIBXML_NOERROR);
|
||||
$dom->registerNodeClass("Dom\\Element", "MyElement");
|
||||
|
||||
// Destroy reference to the DOM
|
||||
$child = $dom->documentElement;
|
||||
unset($dom);
|
||||
|
||||
// Regain reference using the ownerDocument property
|
||||
// Should be a DOM\HTMLDocument
|
||||
// Should be a Dom\HTMLDocument
|
||||
$dom = $child->ownerDocument;
|
||||
var_dump($dom);
|
||||
// Test if property is preserved (any random doc_props property will do)
|
||||
|
@ -23,7 +23,7 @@ var_dump(get_class($dom->getElementsByTagName("p")->item(0)));
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(DOM\HTMLDocument)#1 (25) {
|
||||
object(Dom\HTMLDocument)#1 (25) {
|
||||
["implementation"]=>
|
||||
string(22) "(object value omitted)"
|
||||
["URL"]=>
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument should retain properties and ownerDocument relation 02
|
||||
Dom\HTMLDocument should retain properties and ownerDocument relation 02
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class MyElement extends DOM\Element {}
|
||||
class MyElement extends Dom\Element {}
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p>foo</p>", LIBXML_NOERROR);
|
||||
$dom->registerNodeClass("DOM\\Element", "MyElement");
|
||||
$dom = Dom\HTMLDocument::createFromString("<p>foo</p>", LIBXML_NOERROR);
|
||||
$dom->registerNodeClass("Dom\\Element", "MyElement");
|
||||
$child = $dom->documentElement->appendChild($dom->createElement('html'));
|
||||
|
||||
// Destroy reference to the DOM
|
||||
unset($dom);
|
||||
|
||||
// Regain reference using the ownerDocument property
|
||||
// Should be a DOM\HTMLDocument
|
||||
// Should be a Dom\HTMLDocument
|
||||
$dom = $child->ownerDocument;
|
||||
var_dump($dom);
|
||||
// Test if property is preserved (any random doc_props property will do)
|
||||
|
@ -23,7 +23,7 @@ var_dump(get_class($dom->getElementsByTagName("p")->item(0)));
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(DOM\HTMLDocument)#1 (25) {
|
||||
object(Dom\HTMLDocument)#1 (25) {
|
||||
["implementation"]=>
|
||||
string(22) "(object value omitted)"
|
||||
["URL"]=>
|
||||
|
|
|
@ -12,7 +12,7 @@ $html = str_repeat("\n", 65536) . <<<EOF
|
|||
</body>
|
||||
EOF;
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString($html);
|
||||
$dom = Dom\HTMLDocument::createFromString($html);
|
||||
var_dump($dom->documentElement->firstChild->nextSibling->firstChild->nextSibling->getLineNo());
|
||||
|
||||
?>
|
||||
|
|
|
@ -7,25 +7,25 @@ dom
|
|||
|
||||
echo "--- Parsing ---\n";
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<!doctype html><html><body><noscript><p>hi</p></noscript></body></html>", DOM\HTML_NO_DEFAULT_NS);
|
||||
$dom = Dom\HTMLDocument::createFromString("<!doctype html><html><body><noscript><p>hi</p></noscript></body></html>", Dom\HTML_NO_DEFAULT_NS);
|
||||
var_dump($dom->documentElement->textContent);
|
||||
var_dump($dom->documentElement->namespaceURI);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveXML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
echo $dom->saveXml(), "\n";
|
||||
|
||||
echo "--- Modifying the text content: tag ---\n";
|
||||
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
$noscript = $xpath->query("//noscript")[0];
|
||||
$noscript->textContent = "<p>bye</p>";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveXML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
echo $dom->saveXml(), "\n";
|
||||
|
||||
echo "--- Modifying the text content: trick ---\n";
|
||||
|
||||
$noscript->textContent = "<!-- </noscript> -->";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveXML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
echo $dom->saveXml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -5,7 +5,7 @@ dom
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
foreach (['DOM\HTMLDocument', 'DOM\XMLDocument'] as $class) {
|
||||
foreach (['Dom\HTMLDocument', 'Dom\XMLDocument'] as $class) {
|
||||
try {
|
||||
$rc = new ReflectionClass($class);
|
||||
$rc->newInstanceWithoutConstructor();
|
||||
|
@ -16,5 +16,5 @@ foreach (['DOM\HTMLDocument', 'DOM\XMLDocument'] as $class) {
|
|||
|
||||
?>
|
||||
--EXPECT--
|
||||
Class DOM\HTMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
|
||||
Class DOM\XMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
|
||||
Class Dom\HTMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
|
||||
Class Dom\XMLDocument is an internal class marked as final that cannot be instantiated without invoking its constructor
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile()/createFromString() BOM with a buffer on the edge
|
||||
Dom\HTMLDocument::createFromFile()/createFromString() BOM with a buffer on the edge
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -9,13 +9,13 @@ $header = "\xEF\xBB\xBF<!doctype html><html><body>";
|
|||
$trailer = "</body></html>";
|
||||
$data = $header . str_repeat("a", 4096 - strlen($header) - strlen($trailer)) . $trailer;
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString($header . str_repeat("a", 4096 - strlen($header) - strlen($trailer)) . $trailer);
|
||||
$dom = Dom\HTMLDocument::createFromString($header . str_repeat("a", 4096 - strlen($header) - strlen($trailer)) . $trailer);
|
||||
var_dump($dom->documentElement->textContent);
|
||||
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
file_put_contents(__DIR__ . "/BOM_edge.tmp", $data);
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/BOM_edge.tmp");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/BOM_edge.tmp");
|
||||
var_dump($dom->documentElement->textContent);
|
||||
|
||||
?>
|
||||
|
|
|
@ -5,7 +5,7 @@ dom
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<svg width="1" xmlns:xlink='http://www.w3.org/1999/xlink'>
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() with DOM\HTML_NO_DEFAULT_NS
|
||||
Dom\HTMLDocument::createFromFile() with Dom\HTML_NO_DEFAULT_NS
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/paragraph.html", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/paragraph.html", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
$xpath->registerNamespace("x", "http://www.w3.org/1999/xhtml");
|
||||
var_dump($xpath->query("//p"));
|
||||
var_dump($xpath->query("//x:p"));
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/paragraph.html", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR | DOM\HTML_NO_DEFAULT_NS);
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/paragraph.html", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR | Dom\HTML_NO_DEFAULT_NS);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
$xpath->registerNamespace("x", "http://www.w3.org/1999/xhtml");
|
||||
var_dump($xpath->query("//p"));
|
||||
var_dump($xpath->query("//x:p"));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(DOM\NodeList)#3 (1) {
|
||||
object(Dom\NodeList)#3 (1) {
|
||||
["length"]=>
|
||||
int(0)
|
||||
}
|
||||
object(DOM\NodeList)#4 (1) {
|
||||
object(Dom\NodeList)#4 (1) {
|
||||
["length"]=>
|
||||
int(1)
|
||||
}
|
||||
object(DOM\NodeList)#3 (1) {
|
||||
object(Dom\NodeList)#3 (1) {
|
||||
["length"]=>
|
||||
int(1)
|
||||
}
|
||||
object(DOM\NodeList)#3 (1) {
|
||||
object(Dom\NodeList)#3 (1) {
|
||||
["length"]=>
|
||||
int(0)
|
||||
}
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - empty path
|
||||
Dom\HTMLDocument::createFromFile() - empty path
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile("");
|
||||
$dom = Dom\HTMLDocument::createFromFile("");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught ValueError: Path cannot be empty in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): DOM\HTMLDocument::createFromFile('')
|
||||
#0 %s(%d): Dom\HTMLDocument::createFromFile('')
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - local existing file
|
||||
Dom\HTMLDocument::createFromFile() - local existing file
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/../../../test.html");
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/../../../test.html");
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DOM\HTMLDocument::createFromFile(): tree error unexpected-token-in-initial-mode in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromFile(): tree error unexpected-token-in-initial-mode in %s on line %d
|
||||
<html><head>
|
||||
<title>Hello world</title>
|
||||
</head>
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - local file that does not exist
|
||||
Dom\HTMLDocument::createFromFile() - local file that does not exist
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__ . "/../foobar");
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__ . "/../foobar");
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DOM\HTMLDocument::createFromFile(%s): Failed to open stream: No such file or directory in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromFile(%s): Failed to open stream: No such file or directory in %s on line %d
|
||||
|
||||
Fatal error: Uncaught Exception: Cannot open file '%s' in %s:%d
|
||||
Stack trace:
|
||||
#0 %s(%d): DOM\HTMLDocument::createFromFile('%s')
|
||||
#0 %s(%d): Dom\HTMLDocument::createFromFile('%s')
|
||||
#1 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - NUL terminator cases path
|
||||
Dom\HTMLDocument::createFromFile() - NUL terminator cases path
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
try {
|
||||
DOM\HTMLDocument::createFromFile("\0");
|
||||
Dom\HTMLDocument::createFromFile("\0");
|
||||
} catch (ValueError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
DOM\HTMLDocument::createFromFile('%00');
|
||||
Dom\HTMLDocument::createFromFile('%00');
|
||||
} catch (ValueError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
DOM\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain any null bytes
|
||||
DOM\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes
|
||||
Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain any null bytes
|
||||
Dom\HTMLDocument::createFromFile(): Argument #1 ($path) must not contain percent-encoded NUL bytes
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - parser warning 01
|
||||
Dom\HTMLDocument::createFromFile() - parser warning 01
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__."/parser_warning_01.html", LIBXML_NOERROR);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__."/parser_warning_01.html", LIBXML_NOERROR);
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - parser warning 02
|
||||
Dom\HTMLDocument::createFromFile() - parser warning 02
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__."/parser_warning_02.html", LIBXML_NOERROR);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__."/parser_warning_02.html", LIBXML_NOERROR);
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - parser warning 03
|
||||
Dom\HTMLDocument::createFromFile() - parser warning 03
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__."/parser_warning_03.html", LIBXML_NOERROR);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__."/parser_warning_03.html", LIBXML_NOERROR);
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() - parser warning libxml_get_last_error()
|
||||
Dom\HTMLDocument::createFromFile() - parser warning libxml_get_last_error()
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -8,7 +8,7 @@ dom
|
|||
libxml_use_internal_errors(true);
|
||||
|
||||
$html = '<>x</> <!doctype html>';
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__."/parser_warning_01.html");
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__."/parser_warning_01.html");
|
||||
|
||||
var_dump(libxml_get_last_error());
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() with failing stream wrapper
|
||||
Dom\HTMLDocument::createFromFile() with failing stream wrapper
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -32,13 +32,13 @@ class FailingWrapper {
|
|||
|
||||
stream_wrapper_register("fail", FailingWrapper::class, 0);
|
||||
|
||||
DOM\HTMLDocument::createFromFile("fail://x");
|
||||
Dom\HTMLDocument::createFromFile("fail://x");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught Error: fail in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: FailingWrapper->stream_read(8192)
|
||||
#1 %s(%d): DOM\HTMLDocument::createFromFile('fail://x')
|
||||
#1 %s(%d): Dom\HTMLDocument::createFromFile('fail://x')
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromFile() with working stream wrapper
|
||||
Dom\HTMLDocument::createFromFile() with working stream wrapper
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -34,15 +34,15 @@ stream_wrapper_register("euw", EchoUriWrapper::class, 0);
|
|||
|
||||
echo "--- Stream wrapper case ---\n";
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromFile("euw://<p>hello</p>");
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromFile("euw://<p>hello</p>");
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
echo "--- Stream wrapper in two chunks case ---\n";
|
||||
|
||||
libxml_use_internal_errors(true);
|
||||
// To properly test this, keep the 4096 in sync with document.c's input stream buffer size.
|
||||
$dom = DOM\HTMLDocument::createFromFile("euw://<!doctype html><html>" . str_repeat("\n", 4096-22) . "<></html>");
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromFile("euw://<!doctype html><html>" . str_repeat("\n", 4096-22) . "<></html>");
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
foreach (libxml_get_errors() as $error) {
|
||||
var_dump($error->line, $error->column);
|
||||
|
@ -52,7 +52,7 @@ foreach (libxml_get_errors() as $error) {
|
|||
--EXPECTF--
|
||||
--- Stream wrapper case ---
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromFile(): tree error unexpected-token-in-initial-mode in euw://<p>hello</p>, line: 1, column: 2 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromFile(): tree error unexpected-token-in-initial-mode in euw://<p>hello</p>, line: 1, column: 2 in %s on line %d
|
||||
<html><head></head><body><p>hello</p></body></html>
|
||||
--- Stream wrapper in two chunks case ---
|
||||
<!DOCTYPE html><html><head></head><body><></body></html>
|
||||
|
|
|
@ -1,37 +1,37 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() with DOM\HTML_NO_DEFAULT_NS
|
||||
Dom\HTMLDocument::createFromString() with Dom\HTML_NO_DEFAULT_NS
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(file_get_contents(__DIR__ . "/paragraph.html"), LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$dom = Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . "/paragraph.html"), LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
$xpath->registerNamespace("x", "http://www.w3.org/1999/xhtml");
|
||||
var_dump($xpath->query("//p"));
|
||||
var_dump($xpath->query("//x:p"));
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(file_get_contents(__DIR__ . "/paragraph.html"), LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR | DOM\HTML_NO_DEFAULT_NS);
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$dom = Dom\HTMLDocument::createFromString(file_get_contents(__DIR__ . "/paragraph.html"), LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR | Dom\HTML_NO_DEFAULT_NS);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
$xpath->registerNamespace("x", "http://www.w3.org/1999/xhtml");
|
||||
var_dump($xpath->query("//p"));
|
||||
var_dump($xpath->query("//x:p"));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(DOM\NodeList)#3 (1) {
|
||||
object(Dom\NodeList)#3 (1) {
|
||||
["length"]=>
|
||||
int(0)
|
||||
}
|
||||
object(DOM\NodeList)#4 (1) {
|
||||
object(Dom\NodeList)#4 (1) {
|
||||
["length"]=>
|
||||
int(1)
|
||||
}
|
||||
object(DOM\NodeList)#3 (1) {
|
||||
object(Dom\NodeList)#3 (1) {
|
||||
["length"]=>
|
||||
int(1)
|
||||
}
|
||||
object(DOM\NodeList)#3 (1) {
|
||||
object(Dom\NodeList)#3 (1) {
|
||||
["length"]=>
|
||||
int(0)
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() with LIBXML_COMPACT
|
||||
Dom\HTMLDocument::createFromString() with LIBXML_COMPACT
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -23,7 +23,7 @@ $dom = DOM\HTMLDocument::createFromString(<<<HTML
|
|||
</html>
|
||||
HTML, LIBXML_COMPACT);
|
||||
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
foreach ($xpath->query("//*[name()='p']") as $p) {
|
||||
echo $p->textContent, "\n";
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() with LIBXML_HTML_NOIMPLIED - tree error should not happen
|
||||
Dom\HTMLDocument::createFromString() with LIBXML_HTML_NOIMPLIED - tree error should not happen
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<div>foo</div>", LIBXML_HTML_NOIMPLIED);
|
||||
echo $dom->saveHTML();
|
||||
$dom = Dom\HTMLDocument::createFromString("<div>foo</div>", LIBXML_HTML_NOIMPLIED);
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() with LIBXML_HTML_NOIMPLIED namespace check
|
||||
Dom\HTMLDocument::createFromString() with LIBXML_HTML_NOIMPLIED namespace check
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -7,20 +7,20 @@ dom
|
|||
|
||||
echo "--- No elements ---\n";
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
echo $dom->saveXML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString("", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
echo $dom->saveXml(), "\n";
|
||||
|
||||
echo "--- Single element ---\n";
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p>foo</p>", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
echo $dom->saveXML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString("<p>foo</p>", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
echo $dom->saveXml(), "\n";
|
||||
var_dump($dom->documentElement->namespaceURI);
|
||||
var_dump($dom->documentElement->prefix);
|
||||
|
||||
echo "--- Multiple elements ---\n";
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p>foo</p><strong>bar</strong>", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
echo $dom->saveXML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString("<p>foo</p><strong>bar</strong>", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
echo $dom->saveXml(), "\n";
|
||||
var_dump($dom->documentElement->namespaceURI);
|
||||
var_dump($dom->documentElement->prefix);
|
||||
var_dump($dom->documentElement->nextSibling->namespaceURI);
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - empty document
|
||||
Dom\HTMLDocument::createFromString() - empty document
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString('');
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString('');
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString()/createFromFile() with LIBXML_HTML_NOIMPLIED
|
||||
Dom\HTMLDocument::createFromString()/createFromFile() with LIBXML_HTML_NOIMPLIED
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
function test(string $html) {
|
||||
echo "Testing: $html\n";
|
||||
$dom = DOM\HTMLDocument::createFromString($html, LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
$output = $dom->saveHTML();
|
||||
$dom = Dom\HTMLDocument::createFromString($html, LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
$output = $dom->saveHtml();
|
||||
echo $output, "\n";
|
||||
|
||||
// Also test the loadHTMLFile variation. We won't print out the result, just checking the result is the same.
|
||||
$temp = fopen(__DIR__."/DOM_HTMLDocument_loadHTML_LIBXML_HTML_NOIMPLIED_input.tmp", "w");
|
||||
fwrite($temp, $html);
|
||||
fclose($temp);
|
||||
$dom = DOM\HTMLDocument::createFromFile(__DIR__."/DOM_HTMLDocument_loadHTML_LIBXML_HTML_NOIMPLIED_input.tmp", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
var_dump($output === $dom->saveHTML());
|
||||
$dom = Dom\HTMLDocument::createFromFile(__DIR__."/DOM_HTMLDocument_loadHTML_LIBXML_HTML_NOIMPLIED_input.tmp", LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR);
|
||||
var_dump($output === $dom->saveHtml());
|
||||
}
|
||||
|
||||
echo "--- Missing html, head, body ---\n";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - line and column test
|
||||
Dom\HTMLDocument::createFromString() - line and column test
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -22,7 +22,7 @@ $dom = DOM\HTMLDocument::createFromString(<<<HTML
|
|||
</html>
|
||||
HTML);
|
||||
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
|
||||
foreach ($xpath->query("//*") as $element) {
|
||||
echo "Element: '", $element->tagName, "', ", $element->getLineNo(), "\n";
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - normal document, no error
|
||||
Dom\HTMLDocument::createFromString() - normal document, no error
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -21,8 +21,8 @@ $html = <<<HTML
|
|||
</body>
|
||||
</html>
|
||||
HTML;
|
||||
$dom = DOM\HTMLDocument::createFromString($html);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString($html);
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString(): Old DTD
|
||||
Dom\HTMLDocument::createFromString(): Old DTD
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
|
@ -16,13 +16,13 @@ $dom = DOM\HTMLDocument::createFromString(<<<HTML
|
|||
HTML);
|
||||
|
||||
echo "--- HTML serialization ---\n";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
echo "--- XML serialization ---\n";
|
||||
echo $dom->saveXML();
|
||||
echo $dom->saveXml();
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DOM\HTMLDocument::createFromString(): tree error bad-doctype-token-in-initial-mode in Entity, line: 1, column: 3-9 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tree error bad-doctype-token-in-initial-mode in Entity, line: 1, column: 3-9 in %s on line %d
|
||||
--- HTML serialization ---
|
||||
<!DOCTYPE html><html><head>
|
||||
</head>
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - parser warning 01
|
||||
Dom\HTMLDocument::createFromString() - parser warning 01
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$html = file_get_contents(__DIR__."/parser_warning_01.html");
|
||||
$dom = DOM\HTMLDocument::createFromString($html);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString($html);
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DOM\HTMLDocument::createFromString(): tokenizer error missing-end-tag-name in Entity, line: 7, column: 11 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tokenizer error missing-end-tag-name in Entity, line: 7, column: 11 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tree error unexpected-token-in-initial-mode in Entity, line: 1, column: 2-6 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-token-in-initial-mode in Entity, line: 1, column: 2-6 in %s on line %d
|
||||
<html><head><title>foo</title>
|
||||
</head><body><datalist id="fruits">
|
||||
<option value="Apple">
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - parser warning 02
|
||||
Dom\HTMLDocument::createFromString() - parser warning 02
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$html = file_get_contents(__DIR__."/parser_warning_02.html");
|
||||
$dom = DOM\HTMLDocument::createFromString($html);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString($html);
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: DOM\HTMLDocument::createFromString(): tokenizer error unexpected-null-character in Entity, line: 4, column: 11 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tokenizer error unexpected-null-character in Entity, line: 4, column: 11 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tokenizer error missing-whitespace-between-attributes in Entity, line: 5, column: 20 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tokenizer error missing-whitespace-between-attributes in Entity, line: 5, column: 20 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tokenizer error incorrectly-opened-comment in Entity, line: 6, column: 11 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tokenizer error incorrectly-opened-comment in Entity, line: 6, column: 11 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tokenizer error nested-comment in Entity, line: 7, column: 18 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tokenizer error nested-comment in Entity, line: 7, column: 18 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tree error unexpected-closed-token in Entity, line: 4, column: 18 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tree error unexpected-closed-token in Entity, line: 4, column: 18 in %s on line %d
|
||||
|
||||
Warning: DOM\HTMLDocument::createFromString(): tree error doctype-token-in-body-mode in Entity, line: 8, column: 11-17 in %s on line %d
|
||||
Warning: Dom\HTMLDocument::createFromString(): tree error doctype-token-in-body-mode in Entity, line: 8, column: 11-17 in %s on line %d
|
||||
<!DOCTYPE html><html><head></head><body>
|
||||
<p<>>foo<p></p>
|
||||
<p id="foo" class="bar">
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - parser warning 03
|
||||
Dom\HTMLDocument::createFromString() - parser warning 03
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$html = file_get_contents(__DIR__."/parser_warning_03.html");
|
||||
$dom = DOM\HTMLDocument::createFromString($html, LIBXML_NOERROR);
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString($html, LIBXML_NOERROR);
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - parser warning via internal error
|
||||
Dom\HTMLDocument::createFromString() - parser warning via internal error
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -8,7 +8,7 @@ dom
|
|||
libxml_use_internal_errors(true);
|
||||
|
||||
$html = '<>x</> <!doctype html>';
|
||||
$dom = DOM\HTMLDocument::createFromString($html);
|
||||
$dom = Dom\HTMLDocument::createFromString($html);
|
||||
foreach (libxml_get_errors() as $error) {
|
||||
var_dump($error->message, $error->line, $error->column);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument::createFromString() - document without body
|
||||
Dom\HTMLDocument::createFromString() - document without body
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString('<!doctype html><p align="\'">foo '</p>');
|
||||
echo $dom->saveHTML(), "\n";
|
||||
$dom = Dom\HTMLDocument::createFromString('<!doctype html><p align="\'">foo '</p>');
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument: loading $options check
|
||||
Dom\HTMLDocument: loading $options check
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -30,7 +30,7 @@ foreach (["createFromString", "createFromFile"] as $method) {
|
|||
foreach ($tested_options as $options) {
|
||||
var_dump($options);
|
||||
try {
|
||||
DOM\HTMLDocument::{$method}("x", $options);
|
||||
Dom\HTMLDocument::{$method}("x", $options);
|
||||
} catch (ValueError $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
@ -41,67 +41,67 @@ foreach (["createFromString", "createFromFile"] as $method) {
|
|||
--EXPECTF--
|
||||
--- Method createFromString ---
|
||||
int(%d)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4194304)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(524288)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(8)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(16)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(256)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(16384)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(2)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(1024)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(1)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(2048)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(64)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(128)
|
||||
DOM\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromString(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
--- Method createFromFile ---
|
||||
int(%d)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4194304)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(524288)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(8)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(16)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(256)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(16384)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(4)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(2)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(1024)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(1)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(2048)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(64)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
int(128)
|
||||
DOM\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, DOM\NO_DEFAULT_NS)
|
||||
Dom\HTMLDocument::createFromFile(): Argument #2 ($options) contains invalid flags (allowed flags: LIBXML_NOERROR, LIBXML_COMPACT, LIBXML_HTML_NOIMPLIED, Dom\NO_DEFAULT_NS)
|
||||
|
|
|
@ -5,7 +5,7 @@ dom
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -28,7 +28,7 @@ $dom = DOM\HTMLDocument::createFromString(<<<HTML
|
|||
HTML);
|
||||
|
||||
echo "--- Namespaces ---\n";
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
foreach ($xpath->query("//*[name()='body']//*") as $node) {
|
||||
echo $node->nodeName, " ", $node->namespaceURI ?? "(NONE)", "\n";
|
||||
foreach ($node->attributes as $attribute) {
|
||||
|
@ -37,9 +37,9 @@ foreach ($xpath->query("//*[name()='body']//*") as $node) {
|
|||
}
|
||||
|
||||
echo "--- HTML serialization ---\n";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
echo "--- XML serialization ---\n";
|
||||
echo $dom->saveXML();
|
||||
echo $dom->saveXml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -11,9 +11,9 @@ set_error_handler(function ($errno, $errstr, $errfile, $errline) {
|
|||
var_dump($errno, $errstr);
|
||||
}, E_WARNING);
|
||||
|
||||
DOM\HTMLDocument::createFromString('<html></html>');
|
||||
Dom\HTMLDocument::createFromString('<html></html>');
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
int(2)
|
||||
string(113) "DOM\HTMLDocument::createFromString(): tree error unexpected-token-in-initial-mode in Entity, line: 1, column: 2-5"
|
||||
string(113) "Dom\HTMLDocument::createFromString(): tree error unexpected-token-in-initial-mode in Entity, line: 1, column: 2-5"
|
||||
|
|
|
@ -5,7 +5,7 @@ dom
|
|||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
@ -18,7 +18,7 @@ $dom = DOM\HTMLDocument::createFromString(<<<HTML
|
|||
HTML);
|
||||
|
||||
echo "--- Namespaces ---\n";
|
||||
$xpath = new DOM\XPath($dom);
|
||||
$xpath = new Dom\XPath($dom);
|
||||
foreach ($xpath->query("//*[name()='body']//*") as $node) {
|
||||
echo $node->nodeName, " ", $node->namespaceURI ?? "(NONE)", "\n";
|
||||
echo "prefix: \"", $node->prefix, "\"\n";
|
||||
|
@ -28,9 +28,9 @@ foreach ($xpath->query("//*[name()='body']//*") as $node) {
|
|||
}
|
||||
|
||||
echo "--- HTML serialization ---\n";
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
echo "--- XML serialization ---\n";
|
||||
echo $dom->saveXML();
|
||||
echo $dom->saveXml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -9,11 +9,11 @@ $dom1 = new DOMDocument();
|
|||
$root = $dom1->appendChild($dom1->createElement('root'));
|
||||
$root->appendChild($dom1->createEntityReference('nbsp'));
|
||||
|
||||
$dom2 = DOM\HTMLDocument::createEmpty();
|
||||
$dom2 = Dom\HTMLDocument::createEmpty();
|
||||
$dom2->appendChild($dom2->importLegacyNode($root, true));
|
||||
|
||||
echo $dom2->saveXML(), "\n";
|
||||
echo $dom2->saveHTML(), "\n";
|
||||
echo $dom2->saveXml(), "\n";
|
||||
echo $dom2->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization escape attribute
|
||||
Dom\HTMLDocument serialization escape attribute
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p></p>", LIBXML_NOERROR);
|
||||
$dom = Dom\HTMLDocument::createFromString("<p></p>", LIBXML_NOERROR);
|
||||
$p = $dom->documentElement->firstChild->nextSibling->firstChild;
|
||||
$p->setAttribute("foo", "<bar>\"'&");
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization escape nbsp
|
||||
Dom\HTMLDocument serialization escape nbsp
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p>these must transform: \xc2\xa0\xc2\xa0 but these not: \xa0|\xc2...</p><br>", LIBXML_NOERROR);
|
||||
echo $dom->saveHTML();
|
||||
$dom = Dom\HTMLDocument::createFromString("<p>these must transform: \xc2\xa0\xc2\xa0 but these not: \xa0|\xc2...</p><br>", LIBXML_NOERROR);
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of an attribute in a namespace
|
||||
Dom\HTMLDocument serialization of an attribute in a namespace
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$root = $dom->appendChild($dom->createElement("root"));
|
||||
$root->setAttributeNodeNS($dom->createAttributeNS("http://php.net", "x:foo"));
|
||||
$root->setAttributeNodeNS($dom->createAttributeNS("http://www.w3.org/XML/1998/namespace", "y:id"));
|
||||
|
@ -14,7 +14,7 @@ $root->setAttributeNodeNS($dom->createAttributeNS("http://www.w3.org/2000/xmlns/
|
|||
$root->setAttributeNodeNS($dom->createAttributeNS("http://www.w3.org/1999/xlink", "z:f"));
|
||||
|
||||
// Note: XML declarations are not emitted in HTML5
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of CData
|
||||
Dom\HTMLDocument serialization of CData
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Note: can't create CData in an HTML document.
|
||||
$dom = DOM\XMLDocument::createEmpty();
|
||||
$dom = Dom\XMLDocument::createEmpty();
|
||||
$cdata = $dom->createCDATASection("foobaré\"<>-&");
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$container = $dom->appendChild($dom->createElement("container"));
|
||||
$container->appendChild($dom->importNode($cdata));
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of comment
|
||||
Dom\HTMLDocument serialization of comment
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$dom->appendChild($dom->createComment("foobaré\"<>-&"));
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of document type
|
||||
Dom\HTMLDocument serialization of document type
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE HTML1234 PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
|
@ -16,10 +16,10 @@ $dom = DOM\HTMLDocument::createFromString(<<<HTML
|
|||
HTML, LIBXML_NOERROR);
|
||||
|
||||
echo "--- XML encoding ---\n";
|
||||
echo $dom->saveXML(), "\n";
|
||||
echo $dom->saveXml(), "\n";
|
||||
echo "--- HTML encoding ---\n";
|
||||
// We don't expect to see the public ID and the system ID because the serialization algorithm doesn't serialize those
|
||||
echo $dom->saveHTML(), "\n";
|
||||
echo $dom->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of element in a namespace
|
||||
Dom\HTMLDocument serialization of element in a namespace
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$root = $dom->appendChild($dom->createElement("root"));
|
||||
|
||||
$root->append("\n");
|
||||
|
@ -16,7 +16,7 @@ $root->append($dom->createElementNS("http://www.w3.org/2000/svg", "s:svg"), "\n"
|
|||
$root->append($dom->createElementNS("http://www.w3.org/1998/Math/MathML", "m:math"), "\n");
|
||||
|
||||
// Note: XML declarations are not emitted in HTML5
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization with a failing stream
|
||||
Dom\HTMLDocument serialization with a failing stream
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
|
@ -33,9 +33,9 @@ class FailingWrapper {
|
|||
|
||||
stream_wrapper_register("failing", "FailingWrapper");
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$root = $dom->appendChild($dom->createElement("root"));
|
||||
$dom->saveHTMLFile("failing://foo");
|
||||
$dom->saveHtmlFile("failing://foo");
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
|
@ -44,6 +44,6 @@ string(1) "<"
|
|||
Fatal error: Uncaught Error: fail in %s:%d
|
||||
Stack trace:
|
||||
#0 [internal function]: FailingWrapper->stream_write('root')
|
||||
#1 %s(%d): DOM\HTMLDocument->saveHTMLFile('failing://foo')
|
||||
#1 %s(%d): Dom\HTMLDocument->saveHtmlFile('failing://foo')
|
||||
#2 {main}
|
||||
thrown in %s on line %d
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of document fragment
|
||||
Dom\HTMLDocument serialization of document fragment
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$fragment = $dom->createDocumentFragment();
|
||||
$fragment->appendChild($dom->createElement("foo"));
|
||||
$bar = $fragment->appendChild($dom->createElement("bar"));
|
||||
$fragment->appendChild($dom->createElement("baz"));
|
||||
$bar->appendChild($dom->createElement("inner"));
|
||||
echo $dom->saveHTML($fragment);
|
||||
echo $dom->saveHtml($fragment);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of full document
|
||||
Dom\HTMLDocument serialization of full document
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString(<<<HTML
|
||||
$dom = Dom\HTMLDocument::createFromString(<<<HTML
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -27,7 +27,7 @@ $dom = DOM\HTMLDocument::createFromString(<<<HTML
|
|||
</body>
|
||||
</html>
|
||||
HTML);
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization with an imported namespace node 01
|
||||
Dom\HTMLDocument serialization with an imported namespace node 01
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = DOM\XMLDocument::createFromString('<?xml version="1.0"?><container xmlns="some:ns" xmlns:bar="another:ns"/>');
|
||||
$xml = Dom\XMLDocument::createFromString('<?xml version="1.0"?><container xmlns="some:ns" xmlns:bar="another:ns"/>');
|
||||
$xml->documentElement->setAttributeNS("http://foo/", "foo:bar", "value");
|
||||
$xml->documentElement->appendChild($xml->createElementNS('some:ns2', 'child'));
|
||||
echo $xml->saveXML(), "\n";
|
||||
echo $xml->saveXml(), "\n";
|
||||
|
||||
echo "--- After import into HTML ---\n";
|
||||
|
||||
$html = DOM\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
$html = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
|
||||
$p = $html->documentElement->firstChild->nextSibling->firstChild;
|
||||
$p->appendChild($html->importNode($xml->documentElement, true));
|
||||
|
||||
echo $html->saveXML(), "\n";
|
||||
echo $html->saveHTML(), "\n";
|
||||
echo $html->saveXml(), "\n";
|
||||
echo $html->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization with an imported namespace node 02
|
||||
Dom\HTMLDocument serialization with an imported namespace node 02
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = DOM\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml = Dom\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml->documentElement->appendChild($xml->createElementNS('some:ns2', 'child'));
|
||||
echo $xml->saveXML(), "\n";
|
||||
echo $xml->saveXml(), "\n";
|
||||
|
||||
echo "--- After import into HTML ---\n";
|
||||
|
||||
$html = DOM\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
$html = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
|
||||
$p = $html->documentElement->firstChild->nextSibling->firstChild;
|
||||
$p->appendChild($html->importNode($xml->documentElement, true));
|
||||
|
||||
echo $html->saveXML(), "\n";
|
||||
echo $html->saveHTML(), "\n";
|
||||
echo $html->saveXml(), "\n";
|
||||
echo $html->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization with an imported namespace node 03
|
||||
Dom\HTMLDocument serialization with an imported namespace node 03
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = DOM\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml = Dom\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml->documentElement->appendChild($xml->createElementNS('some:ns2', 'child'));
|
||||
echo $xml->saveXML(), "\n";
|
||||
echo $xml->saveXml(), "\n";
|
||||
|
||||
echo "--- After import into HTML ---\n";
|
||||
|
||||
$html = DOM\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
$html = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
|
||||
$p = $html->documentElement->firstChild->nextSibling->firstChild;
|
||||
$p->appendChild($html->importNode($xml->documentElement, false));
|
||||
|
||||
echo $html->saveXML(), "\n";
|
||||
echo $html->saveHTML(), "\n";
|
||||
echo $html->saveXml(), "\n";
|
||||
echo $html->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization with an imported namespace node 04
|
||||
Dom\HTMLDocument serialization with an imported namespace node 04
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = DOM\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml = Dom\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml->documentElement->appendChild($xml->createElementNS('some:ns2', 'child'));
|
||||
echo $xml->saveXML(), "\n";
|
||||
echo $xml->saveXml(), "\n";
|
||||
|
||||
echo "--- After import into HTML ---\n";
|
||||
|
||||
$html = DOM\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
$html = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
|
||||
$p = $html->documentElement->firstChild->nextSibling->firstChild;
|
||||
$p->appendChild($html->importNode($xml->documentElement, false));
|
||||
|
||||
echo $html->saveXML(), "\n";
|
||||
echo $html->saveHTML(), "\n";
|
||||
echo $html->saveXml(), "\n";
|
||||
echo $html->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization with an imported namespace node 05
|
||||
Dom\HTMLDocument serialization with an imported namespace node 05
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = DOM\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml = Dom\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml->documentElement->appendChild($xml->createElementNS('some:ns2', 'child'));
|
||||
echo $xml->saveXML(), "\n";
|
||||
echo $xml->saveXml(), "\n";
|
||||
|
||||
echo "--- After adoption into HTML ---\n";
|
||||
|
||||
$html = DOM\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
$html = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
|
||||
$p = $html->documentElement->firstChild->nextSibling->firstChild;
|
||||
$p->appendChild($html->adoptNode($xml->documentElement));
|
||||
|
||||
echo $html->saveXML(), "\n";
|
||||
echo $html->saveHTML(), "\n";
|
||||
echo $html->saveXml(), "\n";
|
||||
echo $html->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization with an imported namespace node 06
|
||||
Dom\HTMLDocument serialization with an imported namespace node 06
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$xml = DOM\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml = Dom\XMLDocument::createFromFile(__DIR__.'/sample.xml');
|
||||
$xml->documentElement->firstElementChild->appendChild($xml->createElementNS('some:ns2', 'child'));
|
||||
echo $xml->saveXML(), "\n";
|
||||
echo $xml->saveXml(), "\n";
|
||||
|
||||
echo "--- After clone + import into HTML ---\n";
|
||||
|
||||
$html = DOM\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
$html = Dom\HTMLDocument::createFromString('<p>foo</p>', LIBXML_NOERROR);
|
||||
|
||||
$p = $html->documentElement->firstElementChild->nextElementSibling->firstElementChild;
|
||||
$p->appendChild($html->adoptNode($xml->documentElement->firstElementChild->cloneNode(true)));
|
||||
|
||||
echo $html->saveXML(), "\n";
|
||||
echo $html->saveHTML(), "\n";
|
||||
echo $html->saveXml(), "\n";
|
||||
echo $html->saveHtml(), "\n";
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of processing instruction
|
||||
Dom\HTMLDocument serialization of processing instruction
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
// Note: you can put > in a processing instruction element but that breaks (as expected)
|
||||
$dom->appendChild($dom->createProcessingInstruction("target", "foobaré\"&<\xc2\xa0"));
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization of different roots
|
||||
Dom\HTMLDocument serialization of different roots
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
// Note: can't create CData in an HTML document.
|
||||
$dom = DOM\XMLDocument::createEmpty();
|
||||
$dom = Dom\XMLDocument::createEmpty();
|
||||
$cdata = $dom->createCDATASection("cdata");
|
||||
|
||||
$dom = DOM\HTMLDocument::createEmpty();
|
||||
$dom = Dom\HTMLDocument::createEmpty();
|
||||
$container = $dom->appendChild($dom->createElement("container"));
|
||||
$comment = $container->appendChild($dom->createComment("comment"));
|
||||
$cdata = $container->appendChild($dom->importNode($cdata));
|
||||
|
@ -18,12 +18,12 @@ $text = $container->appendChild($dom->createTextNode("text"));
|
|||
$pi = $container->appendChild($dom->createProcessingInstruction("target", "data"));
|
||||
$fragment = $dom->createDocumentFragment();
|
||||
|
||||
var_dump($dom->saveHTML($comment));
|
||||
var_dump($dom->saveHTML($cdata));
|
||||
var_dump($dom->saveHTML($emptyElement));
|
||||
var_dump($dom->saveHTML($text));
|
||||
var_dump($dom->saveHTML($pi));
|
||||
var_dump($dom->saveHTML($fragment));
|
||||
var_dump($dom->saveHtml($comment));
|
||||
var_dump($dom->saveHtml($cdata));
|
||||
var_dump($dom->saveHtml($emptyElement));
|
||||
var_dump($dom->saveHtml($text));
|
||||
var_dump($dom->saveHtml($pi));
|
||||
var_dump($dom->saveHtml($fragment));
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
--TEST--
|
||||
DOM\HTMLDocument serialization escape text 01
|
||||
Dom\HTMLDocument serialization escape text 01
|
||||
--EXTENSIONS--
|
||||
dom
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$dom = DOM\HTMLDocument::createFromString("<p></p>", LIBXML_NOERROR);
|
||||
$dom = Dom\HTMLDocument::createFromString("<p></p>", LIBXML_NOERROR);
|
||||
$p = $dom->documentElement->firstChild->nextSibling->firstChild;
|
||||
$p->textContent = "this is <some> &text! \"\"";
|
||||
echo $dom->saveHTML();
|
||||
echo $dom->saveHtml();
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue