Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:59100 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30138 invoked from network); 20 Mar 2012 22:33:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2012 22:33:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:43374] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/E2-15108-2A5096F4 for ; Tue, 20 Mar 2012 17:33:08 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id B8A0C7000453; Tue, 20 Mar 2012 22:33:02 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id mNAC2OXRnWDr; Tue, 20 Mar 2012 22:33:02 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 1AABA7000452; Tue, 20 Mar 2012 22:33:02 +0000 (WET) Received: from damnation.mshome.net (damnation-air.nl.lo.geleia.net [IPv6:2001:470:94a2:4:7d06:1af1:ea64:2d52]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id C977920071BD; Tue, 20 Mar 2012 22:33:00 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: Internals , "Nicolai Scheer" References: <4F690466.6010102@planetavent.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Date: Tue, 20 Mar 2012 23:33:10 +0100 Message-ID: In-Reply-To: <4F690466.6010102@planetavent.de> User-Agent: Opera Mail/11.61 (Win32) Subject: Re: [PHP-DEV] DOMDocument->saveXML with node parameter From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") 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). -- Gustavo Lopes