Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59102 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38093 invoked from network); 20 Mar 2012 23:05:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2012 23:05:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=scope@planetavent.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=scope@planetavent.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain planetavent.de from 89.107.189.172 cause and error) X-PHP-List-Original-Sender: scope@planetavent.de X-Host-Fingerprint: 89.107.189.172 mail.xa8.serverdomain.org Received: from [89.107.189.172] ([89.107.189.172:43571] helo=mail.xa8.serverdomain.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/74-15108-45D096F4 for ; Tue, 20 Mar 2012 18:05:56 -0500 Received: from [10.0.0.20] (ip-178-202-22-28.unitymediagroup.de [178.202.22.28]) (Authenticated sender: xa8190p1) by mail.xa8.serverdomain.org (mail.xa8.serverdomain.org) with ESMTPSA id 2A32C2876588A; Wed, 21 Mar 2012 00:05:53 +0100 (CET) Message-ID: <4F690D51.9000204@planetavent.de> Date: Wed, 21 Mar 2012 00:05:53 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: internals@lists.php.net CC: Gustavo Lopes References: <4F690466.6010102@planetavent.de> In-Reply-To: X-Enigmail-Version: 1.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] DOMDocument->saveXML with node parameter From: scope@planetavent.de (Nicolai Scheer) Hi! On 20.03.2012 23:33, Gustavo Lopes wrote: > On Tue, 20 Mar 2012 23:27:50 +0100, Nicolai Scheer > wrote: > >> >> > $doc = new DOMDocument(); >> $doc->loadHTML( 'Test' ); >> $body = $doc->getElementsByTagName( 'body' )->item( 0 ); >> echo $doc->saveHTML( $body ); >> >> If I compile 5.3.10 myself (RHEL 5.7), I get the very same behaviour as >> described in the last comment of bug 39771: >> >> "PHP Warning: DOMDocument::saveHTML() expects exactly 0 parameters, 1 >> given" >> >> A quick look at the sources of 5.3.10 show, that there is indeed a >> optional node parameter: >> >> ext/dom/document.c:2296: >> >> if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), >> "O|O!", &id, dom_document_class_entry, &nodep, dom_node_class_entry) == >> FAILURE) { >> return; >> } >> >> Yet, the arginfo does not reflect this, e.g. >> >> ext/dom/document.c:158: >> >> ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0) >> ZEND_END_ARG_INFO(); >> >> should read >> >> ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0) >> ZEND_ARG_OBJ_INFO(0, node, DOMNode, 1) >> ZEND_END_ARG_INFO(); >> >> If I allow for passing that optional parameter by adjusting the arginfo, >> the php snippet posted above works just fine. >> >> The documentation of DOMDocument::saveHTML is in sync with the >> implementation of dom_document_save_html, it seems that just the >> parameter checking is wrong. >> > > While the arginfo is in fact wrong and should be fixed, it cannot have > the impact you're describing. The wrong arginfo for internal functions > only affects reflection (except if it has typehints for classes). > > Most likely, you're loading an old version of the DOM extension > (compiled with an earlier version of PHP 5.3). I see. I indeed did use the dom.so shipped with RHEL 5.7 (which delivers php 5.3.3 if I remember correctly), but compiled php 5.3.10 on top of it, still using the old packetized dom extension. So I didn't fix it by adding the arginfo, but by using the self-compiled dom extension from 5.3.10... Thanks for pointing that out! Greetings, Nico