Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51464 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99474 invoked from network); 17 Feb 2011 23:26:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2011 23:26:58 -0000 Authentication-Results: pb1.pair.com header.from=fxmulder@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=fxmulder@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: fxmulder@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:51933] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/A9-46346-0CEAD5D4 for ; Thu, 17 Feb 2011 18:26:56 -0500 Received: by iyb39 with SMTP id 39so3044970iyb.29 for ; Thu, 17 Feb 2011 15:26:54 -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=XR2pOnZgOV2IWfjrP/3bQY0zRE+w6SBRJkVET7MRoCY=; b=Fo5r7ly5JRIZTOyJMkAA07oIUD/cCy5bZonh0tY7LiC5NAUb/2hidEdOFmfNH2tQiB fOQXnjE/BtUtfrBqIHzePN6ZUOmOYG/JFKP2Sfm1FMsliJ6MiC1o5lJQ+LNx/fD1dqBZ YOq/v3P3ooiouOQhprbntxIyLwm92vxOcqRe0= 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=WiEAq0tA1ei5IP9TA3XrRg595CQ1flMj6C1C8WjKZ9GUPPl15nLXOPpJvcuzrTXkIF KZcJtss1fmWFMvetJiPxEXN+Brc3SKTHuf3RAiiQMxm9aNL16ijyUAUnMDbvJCgPpb7g mSh6cvIlg5TlTTE1FEk4bx7OP8SBq+FmfmNjk= MIME-Version: 1.0 Received: by 10.42.228.74 with SMTP id jd10mr13624icb.280.1297985213921; Thu, 17 Feb 2011 15:26:53 -0800 (PST) Received: by 10.42.140.134 with HTTP; Thu, 17 Feb 2011 15:26:53 -0800 (PST) In-Reply-To: <4D5D7C88.1090204@liip.ch> References: <4D5D7C88.1090204@liip.ch> Date: Thu, 17 Feb 2011 16:26:53 -0700 Message-ID: To: Christian Stocker Cc: Pierre Joye , 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: fxmulder@gmail.com (James Devine) I've updated bug request #54037 to include a patch which creates HTML specific constants for HTML_PARSE_NODEFDTD and HTML_PARSE_NOIMPLIED, it also creates LIBXML_PEDANTIC and LIBXML_RECOVER constants On Thu, Feb 17, 2011 at 12:52 PM, Christian Stocker wrote: > Hi > > Looks good to me. But can you add the constants from: > typedef enum { > =A0 =A0HTML_PARSE_RECOVER =A0=3D 1<<0, /* Relaxed parsing */ > =A0 =A0HTML_PARSE_NODEFDTD =3D 1<<2, /* do not default a doctype if not f= ound */ > =A0 =A0HTML_PARSE_NOERROR =A0=3D 1<<5, /* suppress error reports */ > =A0 =A0HTML_PARSE_NOWARNING=3D 1<<6, /* suppress warning reports */ > =A0 =A0HTML_PARSE_PEDANTIC =3D 1<<7, /* pedantic error reporting */ > =A0 =A0HTML_PARSE_NOBLANKS =3D 1<<8, /* remove blank nodes */ > =A0 =A0HTML_PARSE_NONET =A0 =A0=3D 1<<11,/* Forbid network access */ > =A0 =A0HTML_PARSE_NOIMPLIED=3D 1<<13,/* Do not add implied html/body... > elements */ > =A0 =A0HTML_PARSE_COMPACT =A0=3D 1<<16 /* compact small text nodes */ > } htmlParserOption; > > also to it, so that they are available from PHP? I don't like guessing > integers :) > > Maybe we don't have to extra define the ones already defined in > xmlParserOption , eg XML_PARSE_NOERROR, but there's no compagnion to > HTML_PARSE_NODEFDTD and HTML_PARSE_NOIMPLIED > > chregu > > On 17.02.11 16:29, James Devine wrote: >> Will do, thanks! >> >> On Thu, Feb 17, 2011 at 6:43 AM, Pierre Joye wrot= e: >>> 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 wro= te: >>>> 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/docum= ent.c >>>> --- php-5.3.5.orig/ext/dom/document.c =A0 2010-04-02 14:08:15.00000000= 0 -0600 >>>> +++ php-5.3.5.new/ext/dom/document.c =A0 =A02011-02-16 16:49:20.000000= 000 -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 >>>> >>>> >>> >>> >>> >>> -- >>> Pierre >>> >>> @pierrejoye | http://blog.thepimp.net | http://www.libgd.org >>> >> >