diff options
author | Ondřej Surý <ondrej@sury.org> | 2012-04-06 14:37:49 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2012-04-06 14:37:49 +0200 |
commit | 7b10b0041aa63c6f8990ceb3ccc190bdd9eea2b9 (patch) | |
tree | 01edb9389d7b7f6b277a57e2bce1d05f9748d609 /ext/dom | |
parent | 096b2f823b2273e3ee707b3805feb78d1e4be61d (diff) | |
download | php-7b10b0041aa63c6f8990ceb3ccc190bdd9eea2b9.tar.gz |
Imported Upstream version 5.4.1~rc1upstream/5.4.1_rc1
Diffstat (limited to 'ext/dom')
52 files changed, 239 insertions, 114 deletions
diff --git a/ext/dom/attr.c b/ext/dom/attr.c index 426b19316..98f645fc7 100644 --- a/ext/dom/attr.c +++ b/ext/dom/attr.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: attr.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/cdatasection.c b/ext/dom/cdatasection.c index 18f137d82..8d8ef6117 100644 --- a/ext/dom/cdatasection.c +++ b/ext/dom/cdatasection.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: cdatasection.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/characterdata.c b/ext/dom/characterdata.c index eb4092541..edf90b788 100644 --- a/ext/dom/characterdata.c +++ b/ext/dom/characterdata.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: characterdata.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/comment.c b/ext/dom/comment.c index 5146fef52..128b58d54 100644 --- a/ext/dom/comment.c +++ b/ext/dom/comment.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: comment.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/config.m4 b/ext/dom/config.m4 index 89dd4c037..7882483b3 100644 --- a/ext/dom/config.m4 +++ b/ext/dom/config.m4 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4 239118 2007-07-03 17:25:43Z sniper $ +dnl $Id$ dnl PHP_ARG_ENABLE(dom, whether to enable DOM support, diff --git a/ext/dom/config.w32 b/ext/dom/config.w32 index 6b38f0737..cbe15af1a 100644 --- a/ext/dom/config.w32 +++ b/ext/dom/config.w32 @@ -1,4 +1,4 @@ -// $Id: config.w32 306241 2010-12-11 22:18:10Z pajoye $ +// $Id$ // vim:ft=javascript ARG_WITH("dom", "DOM support", "yes"); diff --git a/ext/dom/document.c b/ext/dom/document.c index 1067fe3be..1d7f46a9b 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: document.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index 5ec2d7672..28b6d2078 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: documentfragment.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/documenttype.c b/ext/dom/documenttype.c index 8f583e547..d61ba796a 100644 --- a/ext/dom/documenttype.c +++ b/ext/dom/documenttype.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: documenttype.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/dom_ce.h b/ext/dom/dom_ce.h index a343d5a96..815081229 100644 --- a/ext/dom/dom_ce.h +++ b/ext/dom/dom_ce.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dom_ce.h 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifndef DOM_CE_H #define DOM_CE_H diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h index 8e831be6d..243c7d166 100644 --- a/ext/dom/dom_fe.h +++ b/ext/dom/dom_fe.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dom_fe.h 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifndef DOM_FE_H #define DOM_FE_H diff --git a/ext/dom/dom_iterators.c b/ext/dom/dom_iterators.c index 7e9178fb0..92302b1b4 100644 --- a/ext/dom/dom_iterators.c +++ b/ext/dom/dom_iterators.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dom_iterators.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/dom_properties.h b/ext/dom/dom_properties.h index 2f642a589..0897d932e 100644 --- a/ext/dom/dom_properties.h +++ b/ext/dom/dom_properties.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dom_properties.h 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifndef DOM_PROPERTIES_H #define DOM_PROPERTIES_H diff --git a/ext/dom/domconfiguration.c b/ext/dom/domconfiguration.c index 37be948b1..c60f28b0f 100644 --- a/ext/dom/domconfiguration.c +++ b/ext/dom/domconfiguration.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domconfiguration.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domerror.c b/ext/dom/domerror.c index f4ac4cfe1..278de1636 100644 --- a/ext/dom/domerror.c +++ b/ext/dom/domerror.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domerror.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domerrorhandler.c b/ext/dom/domerrorhandler.c index c22405b02..f1ab2871a 100644 --- a/ext/dom/domerrorhandler.c +++ b/ext/dom/domerrorhandler.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domerrorhandler.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c index 0f9b367ab..787e1f3ae 100644 --- a/ext/dom/domexception.c +++ b/ext/dom/domexception.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domexception.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domimplementation.c b/ext/dom/domimplementation.c index 9fc36a74c..92715ce03 100644 --- a/ext/dom/domimplementation.c +++ b/ext/dom/domimplementation.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domimplementation.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domimplementationlist.c b/ext/dom/domimplementationlist.c index 2f91e68a2..5926185ca 100644 --- a/ext/dom/domimplementationlist.c +++ b/ext/dom/domimplementationlist.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domimplementationlist.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domimplementationsource.c b/ext/dom/domimplementationsource.c index af5c3a858..fe7eae408 100644 --- a/ext/dom/domimplementationsource.c +++ b/ext/dom/domimplementationsource.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domimplementationsource.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domlocator.c b/ext/dom/domlocator.c index 7cb64bf3d..8671ae830 100644 --- a/ext/dom/domlocator.c +++ b/ext/dom/domlocator.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domlocator.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/domstringlist.c b/ext/dom/domstringlist.c index dd815e9b9..8e679cee2 100644 --- a/ext/dom/domstringlist.c +++ b/ext/dom/domstringlist.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: domstringlist.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/element.c b/ext/dom/element.c index c524af0ef..c6a190212 100644 --- a/ext/dom/element.c +++ b/ext/dom/element.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: element.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/entity.c b/ext/dom/entity.c index c4888e1cc..36df57dba 100644 --- a/ext/dom/entity.c +++ b/ext/dom/entity.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: entity.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/entityreference.c b/ext/dom/entityreference.c index 8e3799e2b..0a5f41d62 100644 --- a/ext/dom/entityreference.c +++ b/ext/dom/entityreference.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: entityreference.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 1a791a44a..e6c8fffef 100644 --- a/ext/dom/namednodemap.c +++ b/ext/dom/namednodemap.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: namednodemap.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/namelist.c b/ext/dom/namelist.c index 73f5332f7..cf3500aa7 100644 --- a/ext/dom/namelist.c +++ b/ext/dom/namelist.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: namelist.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/node.c b/ext/dom/node.c index b27c779ea..4e58421e4 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: node.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 02296fe3b..21d23503a 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: nodelist.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/notation.c b/ext/dom/notation.c index 18c56e27a..081c79957 100644 --- a/ext/dom/notation.c +++ b/ext/dom/notation.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: notation.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 6ba82aae0..ec7ec1e84 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_dom.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -466,6 +466,87 @@ static int dom_property_exists(zval *object, zval *member, int check_empty, cons } /* }}} */ +static HashTable* dom_get_debug_info_helper(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ +{ + dom_object *obj = zend_object_store_get_object(object TSRMLS_CC); + HashTable *debug_info, + *prop_handlers = obj->prop_handler, + *std_props; + HashPosition pos; + dom_prop_handler *entry; + zval *object_value, + *null_value; + + *is_temp = 1; + + ALLOC_HASHTABLE(debug_info); + ZEND_INIT_SYMTABLE_EX(debug_info, 32, 0); + + std_props = zend_std_get_properties(object TSRMLS_CC); + zend_hash_copy(debug_info, std_props, (copy_ctor_func_t)zval_add_ref, + NULL, sizeof(zval*)); + + if (!prop_handlers) { + return debug_info; + } + + ALLOC_INIT_ZVAL(object_value); + ZVAL_STRING(object_value, "(object value omitted)", 1); + + ALLOC_INIT_ZVAL(null_value); + ZVAL_NULL(null_value); + + for (zend_hash_internal_pointer_reset_ex(prop_handlers, &pos); + zend_hash_get_current_data_ex(prop_handlers, (void **)&entry, &pos) + == SUCCESS; + zend_hash_move_forward_ex(prop_handlers, &pos)) { + zval *value; + char *string_key = NULL; + uint string_length = 0; + ulong num_key; + + if (entry->read_func(obj, &value TSRMLS_CC) == FAILURE) { + continue; + } + + if (zend_hash_get_current_key_ex(prop_handlers, &string_key, + &string_length, &num_key, 0, &pos) != HASH_KEY_IS_STRING) { + continue; + } + + if (value == EG(uninitialized_zval_ptr)) { + value = null_value; + } else if (Z_TYPE_P(value) == IS_OBJECT) { + /* these are zvalues create on demand, with refcount and is_ref + * status left in an uninitalized stated */ + zval_dtor(value); + efree(value); + + value = object_value; + } else { + /* see comment above */ + Z_SET_REFCOUNT_P(value, 0); + Z_UNSET_ISREF_P(value); + } + + zval_add_ref(&value); + zend_hash_add(debug_info, string_key, string_length, + &value, sizeof(zval *), NULL); + } + + zval_ptr_dtor(&null_value); + zval_ptr_dtor(&object_value); + + return debug_info; +} +/* }}} */ + +static HashTable* dom_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ +{ + return dom_get_debug_info_helper(object, is_temp TSRMLS_CC); +} +/* }}} */ + void *php_dom_export_node(zval *object TSRMLS_DC) /* {{{ */ { php_libxml_node_object *intern; @@ -585,6 +666,7 @@ PHP_MINIT_FUNCTION(dom) dom_object_handlers.get_property_ptr_ptr = dom_get_property_ptr_ptr; dom_object_handlers.clone_obj = dom_objects_store_clone_obj; dom_object_handlers.has_property = dom_property_exists; + dom_object_handlers.get_debug_info = dom_get_debug_info; zend_hash_init(&classes, 0, NULL, NULL, 1); diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index b68d1f5d8..e2562a224 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_dom.h 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifndef PHP_DOM_H #define PHP_DOM_H diff --git a/ext/dom/processinginstruction.c b/ext/dom/processinginstruction.c index 199674687..cab8ecc1b 100644 --- a/ext/dom/processinginstruction.c +++ b/ext/dom/processinginstruction.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: processinginstruction.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/string_extend.c b/ext/dom/string_extend.c index ee7f79717..9b5e4c36d 100644 --- a/ext/dom/string_extend.c +++ b/ext/dom/string_extend.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string_extend.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt b/ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt index 6021bac0b..63de77148 100644 --- a/ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt +++ b/ext/dom/tests/DOMDocumentFragment_construct_basic_001.phpt @@ -8,8 +8,7 @@ Eric Lee Stewart <ericleestewart@gmail.com> --FILE-- <?php $fragment = new DOMDocumentFragment(); -var_dump($fragment); +var_dump(get_class($fragment)); ?> ---EXPECTF-- -object(DOMDocumentFragment)#%d (%d) { -} +--EXPECT-- +string(19) "DOMDocumentFragment" diff --git a/ext/dom/tests/DOMElement_hasAttributes_basic.phpt b/ext/dom/tests/DOMElement_hasAttributes_basic.phpt index 8e38d935e..8e804bea9 100644 --- a/ext/dom/tests/DOMElement_hasAttributes_basic.phpt +++ b/ext/dom/tests/DOMElement_hasAttributes_basic.phpt @@ -19,7 +19,7 @@ if(!$dom) { $element = $dom->documentElement; echo "Verify that we have a DOMElement object:\n"; -var_dump($element); +echo get_class($element), "\n"; echo "\nElement should have attributes:\n"; var_dump($element->hasAttributes()); @@ -28,24 +28,22 @@ $nodelist=$dom->getElementsByTagName('tbody') ; $element = $nodelist->item(0); echo "\nVerify that we have a DOMElement object:\n"; -var_dump($element); +echo get_class($element), "\n"; echo "\nElement should have no attributes:\n"; -var_dump($element->hasAttributes()) +var_dump($element->hasAttributes()); ?> --EXPECTF-- Verify that we have a DOMElement object: -object(DOMElement)#%d (0) { -} +DOMElement Element should have attributes: bool(true) Verify that we have a DOMElement object: -object(DOMElement)#%d (0) { -} +DOMElement Element should have no attributes: bool(false) diff --git a/ext/dom/tests/DOMNode_cloneNode_basic.phpt b/ext/dom/tests/DOMNode_cloneNode_basic.phpt index 16b8533f7..cba3c17a2 100644 --- a/ext/dom/tests/DOMNode_cloneNode_basic.phpt +++ b/ext/dom/tests/DOMNode_cloneNode_basic.phpt @@ -29,7 +29,7 @@ EOXML; function dumpcourse($current) { $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title"; - echo "Course: $title:";var_dump($current); + echo "Course: $title:";echo(get_class($current)), "\n"; echo "~";var_dump($current->textContent); } @@ -75,8 +75,7 @@ for ($index = 0; $index < $children->length; $index++) { --EXPECTF-- Start cloneNode test node 0 -Course: new title3:object(DOMElement)#6 (0) { -} +Course: new title3:DOMElement ~string(24) " c1n1 @@ -84,8 +83,7 @@ Course: new title3:object(DOMElement)#6 (0) { " node 1 -Course: two:object(DOMElement)#3 (0) { -} +Course: two:DOMElement ~string(24) " c2n1 @@ -93,12 +91,10 @@ Course: two:object(DOMElement)#3 (0) { " node 2 -Course: new title default:object(DOMElement)#4 (0) { -} +Course: new title default:DOMElement ~string(0) "" node 3 -Course: new title true:object(DOMElement)#7 (0) { -} +Course: new title true:DOMElement ~string(24) " c1n1 @@ -106,6 +102,5 @@ Course: new title true:object(DOMElement)#7 (0) { " node 4 -Course: new title false:object(DOMElement)#8 (0) { -} -~string(0) ""
\ No newline at end of file +Course: new title false:DOMElement +~string(0) "" diff --git a/ext/dom/tests/DOMNode_removeChild_basic.phpt b/ext/dom/tests/DOMNode_removeChild_basic.phpt index 8609e58be..384eb47b5 100644 --- a/ext/dom/tests/DOMNode_removeChild_basic.phpt +++ b/ext/dom/tests/DOMNode_removeChild_basic.phpt @@ -29,7 +29,7 @@ EOXML; function dumpcourse($current) { $title = ($current->nodeType != XML_TEXT_NODE && $current->hasAttribute('title')) ? $current->getAttribute('title'):"no title"; - echo "Course: $title:";var_dump($current); + echo "Course: $title:";echo get_class($current), "\n"; echo "~";var_dump($current->textContent); } @@ -60,13 +60,11 @@ for ($index = 0; $index < $children->length; $index++) { --EXPECTF-- orignal has 5 nodes node 4 -Course: no title:object(DOMText)#4 (0) { -} +Course: no title:DOMText ~string(1) " " node 3 -Course: two:object(DOMElement)#5 (0) { -} +Course: two:DOMElement ~string(24) " c2n1 @@ -74,13 +72,11 @@ Course: two:object(DOMElement)#5 (0) { " node 2 -Course: no title:object(DOMText)#6 (0) { -} +Course: no title:DOMText ~string(2) " " node 1 -Course: one:object(DOMElement)#4 (0) { -} +Course: one:DOMElement ~string(24) " c1n1 @@ -88,14 +84,12 @@ Course: one:object(DOMElement)#4 (0) { " node 0 -Course: no title:object(DOMText)#5 (0) { -} +Course: no title:DOMText ~string(2) " " after text removed it now has 2 nodes node 0 -Course: one:object(DOMElement)#3 (0) { -} +Course: one:DOMElement ~string(24) " c1n1 @@ -103,11 +97,10 @@ Course: one:object(DOMElement)#3 (0) { " node 1 -Course: two:object(DOMElement)#4 (0) { -} +Course: two:DOMElement ~string(24) " c2n1 c2n2 - "
\ No newline at end of file + " diff --git a/ext/dom/tests/bug42082.phpt b/ext/dom/tests/bug42082.phpt index ab018a777..b5fc89316 100644 --- a/ext/dom/tests/bug42082.phpt +++ b/ext/dom/tests/bug42082.phpt @@ -7,7 +7,7 @@ Bug #42082 (NodeList length zero should be empty) $doc = new DOMDocument(); $xpath = new DOMXPath($doc); $nodes = $xpath->query('*'); -var_dump($nodes); +echo get_class($nodes), "\n"; var_dump($nodes->length); $length = $nodes->length; var_dump(empty($nodes->length), empty($length)); @@ -18,8 +18,7 @@ var_dump(empty($doc->nodeType), empty($doc->firstChild->nodeType)) ?> ===DONE=== --EXPECTF-- -object(DOMNodeList)#%d (0) { -} +DOMNodeList int(0) bool(true) bool(true) @@ -29,4 +28,4 @@ bool(true) bool(false) bool(false) ===DONE=== -
\ No newline at end of file + diff --git a/ext/dom/tests/bug52656.phpt b/ext/dom/tests/bug52656.phpt index 860ef99f4..9ec2610b2 100644 --- a/ext/dom/tests/bug52656.phpt +++ b/ext/dom/tests/bug52656.phpt @@ -6,9 +6,9 @@ Bug #52656 (DOMCdataSection does not work with splitText). <?php $CData = new DOMCdataSection('splithere!'); $CDataSplit = $CData->splitText(5); -var_dump($CDataSplit, $CDataSplit->data); +echo get_class($CDataSplit), "\n"; +var_dump($CDataSplit->data); ?> --EXPECT-- -object(DOMText)#2 (0) { -} +DOMText string(5) "here!" diff --git a/ext/dom/tests/bug54601.phpt b/ext/dom/tests/bug54601.phpt index 8a2da2dee..012302bc3 100644 --- a/ext/dom/tests/bug54601.phpt +++ b/ext/dom/tests/bug54601.phpt @@ -17,14 +17,13 @@ $doc = new DOMDocument(); $doc->loadXML($xml, LIBXML_NOENT); $n = $doc->doctype; $doc->removeChild($n); -var_dump($n); +echo get_class($n), "\n"; print $doc->saveXML(); ?> ===DONE=== <?php exit(0); ?> --EXPECTF-- -object(DOMDocumentType)#%d (0) { -} +DOMDocumentType <?xml version="1.0" encoding="utf-8"?> <set><foo>footext</foo><bar>bartext</bar></set> ===DONE=== diff --git a/ext/dom/tests/dom003.phpt b/ext/dom/tests/dom003.phpt index 1fae56908..060a2c184 100644 --- a/ext/dom/tests/dom003.phpt +++ b/ext/dom/tests/dom003.phpt @@ -12,7 +12,11 @@ print "--- Catch exception with try/catch\n"; try { $rootNode->appendChild($rootNode); } catch (domexception $e) { + ob_start(); var_dump($e); + $contents = ob_get_contents(); + ob_end_clean(); + echo preg_replace('/object\(DOMElement\).+\{.*?\}/s', 'DOMElement', $contents); } print "--- Don't catch exception with try/catch\n"; $rootNode->appendChild($rootNode); @@ -47,8 +51,7 @@ object(DOMException)#%d (%d) { ["args"]=> array(1) { [0]=> - object(DOMElement)#%d (0) { - } + DOMElement } } } @@ -61,6 +64,6 @@ object(DOMException)#%d (%d) { Fatal error: Uncaught exception 'DOMException' with message 'Hierarchy Request Error' in %sdom003.php:%d Stack trace: -#0 %sdom003.php(13): DOMNode->appendChild(Object(DOMElement)) +#0 %sdom003.php(%d): DOMNode->appendChild(Object(DOMElement)) #1 {main} thrown in %sdom003.php on line %d diff --git a/ext/dom/tests/dom_comment_basic.phpt b/ext/dom/tests/dom_comment_basic.phpt index cb029ed04..3a6970562 100644 --- a/ext/dom/tests/dom_comment_basic.phpt +++ b/ext/dom/tests/dom_comment_basic.phpt @@ -23,24 +23,21 @@ $children = $root->childNodes; for ($index = 0; $index < $children->length; $index++) { echo "--- child $index ---\n"; $current = $children->item($index); - var_dump($current); + echo get_class($current), "\n"; var_dump($current->textContent); } --EXPECTF-- bool(true) --- child 0 --- -object(DOMText)#%d (0) { -} +DOMText string(2) " " --- child 1 --- -object(DOMComment)#%d (0) { -} +DOMComment string(14) " Hello World! " --- child 2 --- -object(DOMText)#%d (0) { -} +DOMText string(1) " " diff --git a/ext/dom/tests/dom_comment_variation.phpt b/ext/dom/tests/dom_comment_variation.phpt index bef0ef1b1..1f30e7c7e 100644 --- a/ext/dom/tests/dom_comment_variation.phpt +++ b/ext/dom/tests/dom_comment_variation.phpt @@ -20,14 +20,13 @@ $children = $root->childNodes; for ($index = 0; $index < $children->length; $index++) { echo "--- child $index ---\n"; $current = $children->item($index); - var_dump($current); + echo get_class($current), "\n"; var_dump($current->textContent); } --EXPECTF-- bool(true) --- child 0 --- -object(DOMComment)#%d (0) { -} +DOMComment string(14) " Hello World! " diff --git a/ext/dom/tests/dom_set_attr_node.phpt b/ext/dom/tests/dom_set_attr_node.phpt index 05f8086e7..1916cd524 100644 --- a/ext/dom/tests/dom_set_attr_node.phpt +++ b/ext/dom/tests/dom_set_attr_node.phpt @@ -2,6 +2,8 @@ Test: setAttributeNode() --SKIPIF-- <?php require_once('skipif.inc'); ?> +--INI-- +error_reporting = E_ALL & ~E_WARNING --FILE-- <?php @@ -24,9 +26,13 @@ $dom2 = new DOMDocument(); $dom2->loadXML($xml2); $root2 = $dom2->documentElement; try { - $root2->setAttributeNode($attr); + $root2->setAttributeNode($attr); } catch (domexception $e) { - var_dump($e); +ob_start(); + var_dump($e); + $contents = ob_get_contents(); + ob_end_clean(); + echo preg_replace('/object\(DOMAttr\).+\{.*?\}/s', 'DOMAttr', $contents); } ?> @@ -57,8 +63,7 @@ object(DOMException)#%d (7) { ["args"]=> array(1) { [0]=> - object(DOMAttr)#%d (0) { - } + DOMAttr } } } diff --git a/ext/dom/tests/domobject_debug_handler.phpt b/ext/dom/tests/domobject_debug_handler.phpt new file mode 100644 index 000000000..3c9f13354 --- /dev/null +++ b/ext/dom/tests/domobject_debug_handler.phpt @@ -0,0 +1,59 @@ +--TEST-- +Objects of DOM extension: debug info object handler. +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +$xml = <<<XML +<foo> + <bar>foobar</bar> +</foo> +XML; +$d = new domdocument; +$d->dynamicProperty = new stdclass; +$d->loadXML($xml); +print_r($d); +--EXPECTF-- +DOMDocument Object +( + [dynamicProperty] => stdClass Object + ( + ) + + [doctype] => + [implementation] => (object value omitted) + [documentElement] => (object value omitted) + [actualEncoding] => + [encoding] => + [xmlEncoding] => + [standalone] => 1 + [xmlStandalone] => 1 + [version] => 1.0 + [xmlVersion] => 1.0 + [strictErrorChecking] => 1 + [documentURI] => %s + [config] => + [formatOutput] => + [validateOnParse] => + [resolveExternals] => + [preserveWhiteSpace] => 1 + [recover] => + [substituteEntities] => + [nodeName] => #document + [nodeValue] => + [nodeType] => 9 + [parentNode] => + [childNodes] => (object value omitted) + [firstChild] => (object value omitted) + [lastChild] => (object value omitted) + [previousSibling] => + [attributes] => + [ownerDocument] => + [namespaceURI] => + [prefix] => + [localName] => + [baseURI] => %s + [textContent] => + foobar + +) diff --git a/ext/dom/tests/regsiter_node_class.phpt b/ext/dom/tests/regsiter_node_class.phpt index 5444cc4b9..c632c613d 100644 --- a/ext/dom/tests/regsiter_node_class.phpt +++ b/ext/dom/tests/regsiter_node_class.phpt @@ -18,26 +18,23 @@ $doc->registerNodeClass('DOMElement', 'myElement'); $doc->appendChild(new DOMElement('root')); $root = $doc->documentElement; $root->setAttribute('a', 'a1'); -var_dump($root); +echo get_class($root), "\n"; print $root->testit()."\n"; $attr = $root->getAttributeNode('a'); -var_dump($attr); +echo get_class($attr), "\n"; print $attr->testit()."\n"; unset($attr); $doc->registerNodeClass('DOMAttr', NULL); $attr = $root->getAttributeNode('a'); -var_dump($attr); +echo get_class($attr), "\n"; print $attr->testit()."\n"; ?> --EXPECTF-- -object(myElement)#%d (0) { -} +myElement HELLO Element -object(myAttribute)#%d (0) { -} +myAttribute HELLO Attribute -object(DOMAttr)#%d (0) { -} +DOMAttr Fatal error: Call to undefined method DOMAttr::testit() in %s on line 25 diff --git a/ext/dom/text.c b/ext/dom/text.c index 324492ecf..4c129bf38 100644 --- a/ext/dom/text.c +++ b/ext/dom/text.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: text.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/typeinfo.c b/ext/dom/typeinfo.c index 847cff4fd..dec0e46dc 100644 --- a/ext/dom/typeinfo.c +++ b/ext/dom/typeinfo.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: typeinfo.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/userdatahandler.c b/ext/dom/userdatahandler.c index 214ec1beb..b79de59fa 100644 --- a/ext/dom/userdatahandler.c +++ b/ext/dom/userdatahandler.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: userdatahandler.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" diff --git a/ext/dom/xml_common.h b/ext/dom/xml_common.h index 9451ed824..ebe8a516e 100644 --- a/ext/dom/xml_common.h +++ b/ext/dom/xml_common.h @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xml_common.h 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifndef PHP_XML_COMMON_H #define PHP_XML_COMMON_H diff --git a/ext/dom/xpath.c b/ext/dom/xpath.c index 7aeeca953..dd98511e9 100644 --- a/ext/dom/xpath.c +++ b/ext/dom/xpath.c @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xpath.c 321634 2012-01-01 13:15:04Z felipe $ */ +/* $Id$ */ #ifdef HAVE_CONFIG_H #include "config.h" |