Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51454 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6584 invoked from network); 17 Feb 2011 13:43:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2011 13:43:29 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:47431] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5E/24-16134-EF52D5D4 for ; Thu, 17 Feb 2011 08:43:27 -0500 Received: by bwz13 with SMTP id 13so2621761bwz.29 for ; Thu, 17 Feb 2011 05:43:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=R3e1QKHZluR9Fw/tYcIebYM2t47Mfm+kL2oSZ0Q4cdE=; b=mblJ15OyiuYcHnjQF0KrgLNtNLAYpoqvzc4AY8vp+KiTDIEgC6A2a4u3YqvfJCyAdH MOenGxfgo73AKyzdvWlYh3dGFn6Lwocunio8K0iGijUkPC4C/zkGxogHjlJuX8s6+xO1 lRBem3JRWhCXUKM0iAu638/F+zgruR0tYCJgg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=uSQcFkxIGdJw/gs+obmC4NdIGmZvjDL2zX7J1P0Hqtqz1M3UCpurYga4jK5rd0rlS0 k9X4LFXvScjGAkNrDKRZMD5cCbNQl+mxvOqwbTZ0+/yjL8+Xz2+jt9UPUQTTib4Lr6hB NPric1eWv1ojOcJC4EQwiwXz0wKgiYBZrUkGo= MIME-Version: 1.0 Received: by 10.204.113.75 with SMTP id z11mr1710014bkp.90.1297950204021; Thu, 17 Feb 2011 05:43:24 -0800 (PST) Received: by 10.204.55.17 with HTTP; Thu, 17 Feb 2011 05:43:23 -0800 (PST) In-Reply-To: References: Date: Thu, 17 Feb 2011 14:43:23 +0100 Message-ID: To: James Devine Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] PHP Patch for loadHTML options From: pierre.php@gmail.com (Pierre Joye) hi, Can you make a patch against trunk instead please? Also pls follow the CS: if (foo) { } Ideally attach your patch to a feature request at bugs.php.net, so we won't loose it :) thanks for your work! Cheers, On Thu, Feb 17, 2011 at 12:57 AM, James Devine wrote: > I've included a patch for review adding the ability to optionally pass > options to the DOMDocument::loadHTML[File] functions > > > diff -ru php-5.3.5.orig/ext/dom/document.c php-5.3.5.new/ext/dom/document= .c > --- php-5.3.5.orig/ext/dom/document.c =A0 2010-04-02 14:08:15.000000000 -= 0600 > +++ php-5.3.5.new/ext/dom/document.c =A0 =A02011-02-16 16:49:20.000000000= -0700 > @@ -149,10 +149,12 @@ > > =A0ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtml, 0, 0, 1) > =A0 =A0 =A0 =A0ZEND_ARG_INFO(0, source) > + =A0 =A0 =A0 ZEND_ARG_INFO(0, options) > =A0ZEND_END_ARG_INFO(); > > =A0ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_loadhtmlfile, 0, 0, 1) > =A0 =A0 =A0 =A0ZEND_ARG_INFO(0, source) > + =A0 =A0 =A0 ZEND_ARG_INFO(0, options) > =A0ZEND_END_ARG_INFO(); > > =A0ZEND_BEGIN_ARG_INFO_EX(arginfo_dom_document_savehtml, 0, 0, 0) > @@ -2157,10 +2159,11 @@ > =A0 =A0 =A0 =A0char *source; > =A0 =A0 =A0 =A0int source_len, refcount, ret; > =A0 =A0 =A0 =A0htmlParserCtxtPtr ctxt; > + =A0 =A0 =A0 int options =3D 0; > > =A0 =A0 =A0 =A0id =3D getThis(); > > - =A0 =A0 =A0 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", > &source, &source_len) =3D=3D FAILURE) { > + =A0 =A0 =A0 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", > &source, &source_len, &options) =3D=3D FAILURE) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return; > =A0 =A0 =A0 =A0} > > @@ -2180,6 +2183,9 @@ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0RETURN_FALSE; > =A0 =A0 =A0 =A0} > > + =A0 =A0 =A0 if(options) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 htmlCtxtUseOptions(ctxt, options); > + > =A0 =A0 =A0 =A0ctxt->vctxt.error =3D php_libxml_ctx_error; > =A0 =A0 =A0 =A0ctxt->vctxt.warning =3D php_libxml_ctx_warning; > =A0 =A0 =A0 =A0if (ctxt->sax !=3D NULL) { > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org