@@ -698,23 +698,30 @@ PHP_MINIT_FUNCTION(dom)
698
698
zend_hash_add_ptr (& classes , dom_documentfragment_class_entry -> name , & dom_documentfragment_prop_handlers );
699
699
700
700
dom_abstract_base_document_class_entry = register_class_DOM_Document (dom_node_class_entry , dom_parentnode_class_entry );
701
- // TODO: prop handlers
701
+ /* No need to set create_object as it's abstract. */
702
+ HashTable dom_abstract_base_document_prop_handlers ;
703
+ zend_hash_init (& dom_abstract_base_document_prop_handlers , 0 , NULL , dom_dtor_prop_handler , 1 );
704
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "doctype" , sizeof ("doctype" )- 1 , dom_document_doctype_read , NULL );
705
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "implementation" , sizeof ("implementation" )- 1 , dom_document_implementation_read , NULL );
706
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "documentElement" , sizeof ("documentElement" )- 1 , dom_document_document_element_read , NULL );
707
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "strictErrorChecking" , sizeof ("strictErrorChecking" )- 1 , dom_document_strict_error_checking_read , dom_document_strict_error_checking_write );
708
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "documentURI" , sizeof ("documentURI" )- 1 , dom_document_document_uri_read , dom_document_document_uri_write );
709
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "firstElementChild" , sizeof ("firstElementChild" )- 1 , dom_parent_node_first_element_child_read , NULL );
710
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "lastElementChild" , sizeof ("lastElementChild" )- 1 , dom_parent_node_last_element_child_read , NULL );
711
+ dom_register_prop_handler (& dom_abstract_base_document_prop_handlers , "childElementCount" , sizeof ("childElementCount" )- 1 , dom_parent_node_child_element_count , NULL );
712
+ zend_hash_merge (& dom_abstract_base_document_prop_handlers , & dom_node_prop_handlers , dom_copy_prop_handler , 0 );
713
+ /* No need to register in &classes, because this is only used for merging. This is destroyed down below. */
702
714
703
715
dom_document_class_entry = register_class_DOMDocument (dom_abstract_base_document_class_entry );
704
716
dom_document_class_entry -> create_object = dom_objects_new ;
705
717
zend_hash_init (& dom_document_prop_handlers , 0 , NULL , dom_dtor_prop_handler , 1 );
706
- dom_register_prop_handler (& dom_document_prop_handlers , "doctype" , sizeof ("doctype" )- 1 , dom_document_doctype_read , NULL );
707
- dom_register_prop_handler (& dom_document_prop_handlers , "implementation" , sizeof ("implementation" )- 1 , dom_document_implementation_read , NULL );
708
- dom_register_prop_handler (& dom_document_prop_handlers , "documentElement" , sizeof ("documentElement" )- 1 , dom_document_document_element_read , NULL );
709
718
dom_register_prop_handler (& dom_document_prop_handlers , "actualEncoding" , sizeof ("actualEncoding" )- 1 , dom_document_encoding_read , NULL );
710
719
dom_register_prop_handler (& dom_document_prop_handlers , "encoding" , sizeof ("encoding" )- 1 , dom_document_encoding_read , dom_document_encoding_write );
711
720
dom_register_prop_handler (& dom_document_prop_handlers , "xmlEncoding" , sizeof ("xmlEncoding" )- 1 , dom_document_encoding_read , NULL );
712
721
dom_register_prop_handler (& dom_document_prop_handlers , "standalone" , sizeof ("standalone" )- 1 , dom_document_standalone_read , dom_document_standalone_write );
713
722
dom_register_prop_handler (& dom_document_prop_handlers , "xmlStandalone" , sizeof ("xmlStandalone" )- 1 , dom_document_standalone_read , dom_document_standalone_write );
714
723
dom_register_prop_handler (& dom_document_prop_handlers , "version" , sizeof ("version" )- 1 , dom_document_version_read , dom_document_version_write );
715
724
dom_register_prop_handler (& dom_document_prop_handlers , "xmlVersion" , sizeof ("xmlVersion" )- 1 , dom_document_version_read , dom_document_version_write );
716
- dom_register_prop_handler (& dom_document_prop_handlers , "strictErrorChecking" , sizeof ("strictErrorChecking" )- 1 , dom_document_strict_error_checking_read , dom_document_strict_error_checking_write );
717
- dom_register_prop_handler (& dom_document_prop_handlers , "documentURI" , sizeof ("documentURI" )- 1 , dom_document_document_uri_read , dom_document_document_uri_write );
718
725
dom_register_prop_handler (& dom_document_prop_handlers , "config" , sizeof ("config" )- 1 , dom_document_config_read , NULL );
719
726
dom_register_prop_handler (& dom_document_prop_handlers , "formatOutput" , sizeof ("formatOutput" )- 1 , dom_document_format_output_read , dom_document_format_output_write );
720
727
dom_register_prop_handler (& dom_document_prop_handlers , "validateOnParse" , sizeof ("validateOnParse" )- 1 , dom_document_validate_on_parse_read , dom_document_validate_on_parse_write );
@@ -723,11 +730,7 @@ PHP_MINIT_FUNCTION(dom)
723
730
dom_register_prop_handler (& dom_document_prop_handlers , "recover" , sizeof ("recover" )- 1 , dom_document_recover_read , dom_document_recover_write );
724
731
dom_register_prop_handler (& dom_document_prop_handlers , "substituteEntities" , sizeof ("substituteEntities" )- 1 , dom_document_substitue_entities_read , dom_document_substitue_entities_write );
725
732
726
- dom_register_prop_handler (& dom_document_prop_handlers , "firstElementChild" , sizeof ("firstElementChild" )- 1 , dom_parent_node_first_element_child_read , NULL );
727
- dom_register_prop_handler (& dom_document_prop_handlers , "lastElementChild" , sizeof ("lastElementChild" )- 1 , dom_parent_node_last_element_child_read , NULL );
728
- dom_register_prop_handler (& dom_document_prop_handlers , "childElementCount" , sizeof ("childElementCount" )- 1 , dom_parent_node_child_element_count , NULL );
729
-
730
- zend_hash_merge (& dom_document_prop_handlers , & dom_node_prop_handlers , dom_copy_prop_handler , 0 );
733
+ zend_hash_merge (& dom_document_prop_handlers , & dom_abstract_base_document_prop_handlers , dom_copy_prop_handler , 0 );
731
734
zend_hash_add_ptr (& classes , dom_document_class_entry -> name , & dom_document_prop_handlers );
732
735
733
736
dom_html5_document_class_entry = register_class_DOM_HTML5Document (dom_document_class_entry );
@@ -737,6 +740,8 @@ PHP_MINIT_FUNCTION(dom)
737
740
zend_hash_merge (& dom_html5_document_prop_handlers , & dom_document_prop_handlers , dom_copy_prop_handler , 0 );
738
741
zend_hash_add_ptr (& classes , dom_html5_document_class_entry -> name , & dom_html5_document_prop_handlers );
739
742
743
+ zend_hash_destroy (& dom_abstract_base_document_prop_handlers );
744
+
740
745
dom_nodelist_class_entry = register_class_DOMNodeList (zend_ce_aggregate , zend_ce_countable );
741
746
dom_nodelist_class_entry -> create_object = dom_nnodemap_objects_new ;
742
747
dom_nodelist_class_entry -> default_object_handlers = & dom_nodelist_object_handlers ;
0 commit comments