php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #36822 Wrong arguments' order in DomNode->replace_child's manual page
Submitted: 2006-03-22 15:59 UTC Modified: 2006-03-22 18:55 UTC
From: jimmy at powerzone dot dk Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2006-03-22 15:59 UTC] jimmy at powerzone dot dk
Description:
------------
Please browse to the following link :
http://dk.php.net/manual/fi/function.domnode-replace-child.php

According to the documentation, the function should be called like this :

DomNode->replace_child(oldNode, newNode)

This is WRONG!. It should be called like this :

DomNode->replace_child(newNode, oldNode)

I spend hours before I looked in the User Contribution Notes and found the answer. Please correct this bug ASAP as it will save other programmers a lot of time.

Reproduce code:
---------------
NA

Expected result:
----------------
NA

Actual result:
--------------
NA

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-22 18:29 UTC] colder@php.net
It seems to be verified, according to the source:

****
PHP_FUNCTION(dom_node_replace_child)
{

    ...

    if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OOO", &id, dom_node_class_entry, &newnode, dom_node_class_entry, &oldnode, dom_node_class_entry) == FAILURE) {
        return;
    }

****

Here is the patch :

http://patches.colder.ch/domnode-replace-hild.patch

Thanks in advance.
 [2006-03-22 18:38 UTC] colder@php.net
The source quote was about DOM and not DOMXML, sorry.

The documentation problem might not be verified.

 [2006-03-22 18:55 UTC] takagi@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

I verified it in DOMXML (/repository/pecl/domxml/php_domxml.c).

****
/* {{{ proto object domxml_node_replace_child(object newnode, object oldnode)
   Replaces node in list of children */
PHP_FUNCTION(domxml_node_replace_child)
{

    ...

	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oo", &newnode, &oldnode) == FAILURE) {
		return;
	}

    ...

}
****

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 10:01:33 2025 UTC