Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46987 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45510 invoked from network); 14 Feb 2010 16:43:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2010 16:43:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=ewgraf@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ewgraf@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.219 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ewgraf@gmail.com X-Host-Fingerprint: 209.85.219.219 mail-ew0-f219.google.com Received: from [209.85.219.219] ([209.85.219.219:35942] helo=mail-ew0-f219.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BF/0A-03903-E38287B4 for ; Sun, 14 Feb 2010 11:43:43 -0500 Received: by ewy19 with SMTP id 19so2283033ewy.1 for ; Sun, 14 Feb 2010 08:43:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4+wWkEWc3GxOW4unf4biZkPV2RTEJRiEouhRNa1EesA=; b=oSfXU7MFLonrwzPl0b5da9Ng3OYrWhM95ZlH6tIK5CCdYrm0NzmAYdN7gMztZ1XP6U BFzHdQty7AMUw8qvmMT0Cil1LwqAZyMxcIWhE85SgN5tMkNkcWLfpKR47sV91MV/qlDE /Q6blsEdRa+hUCF/iWkKfD8WHdffC+w7zLDSU= 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=Hu8JN4lvHQ1j1aMbIfjqzzMqfTxfGPy0iPAN6sbIgYsoY7gc3syxiPmvpx1Jc9GmJM NzTuwaXl+f0aAe5Hn/mDASKNtkaKnFbds+mQYr8Yh524I4wBLUJo95ckwGwCdxsiLRUB uiU9TbcVNZYNrHNEutGSLnWmqAgf3/iqIAo5Q= MIME-Version: 1.0 Received: by 10.216.171.145 with SMTP id r17mr829897wel.182.1266165817841; Sun, 14 Feb 2010 08:43:37 -0800 (PST) In-Reply-To: <4B77F81C.5080609@php.net> References: <4B77F81C.5080609@php.net> Date: Sun, 14 Feb 2010 21:43:37 +0500 Message-ID: To: Rob Richards Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: help with php bug #47532 From: ewgraf@gmail.com (Sokolov Evgeniy) If you are very busy, you can answer "yes, yes, no" :) 1. > Setting the value using the value property should behave like setting the= value via > the DOMAttr constructor - input should be treated as literal text But in this case value does not be treated: $attr =3D new DOMAttr('test', 'foo&bar'); var_dump($attr->value); string(11) "foo&bar" So, this is bug? May be I misunderstood something? 2. I saw you comment in the bug page. May I write test for this cases and in this testcase show how avoid this "b= ug"? 3. May be add $DOMAttr->getEntitiesValue() method? Because I think htmlspecialchars_decode function are not equal libxml function xmlEncodeEntitiesReentrant (this function use entity table). Is this function used as analog for htmlspecialchars_decode in libxml? Unfortunatelly, I can't find libxml analog function for htmlspecialchars php function :( Thank you. 2010/2/14 Rob Richards : > Sokolov Evgeniy wrote: >> >> Hi, I wont fix this bug: http://bugs.php.net/bug.php?id=3D47532, but >> have some questions. Can you help me? >> >> There is the test case: http://pastebin.org/91030 >> >> First, I careful that when we fix this bug, we have broken BC, because >> now when we write $attr->value =3D "foo&bar"; - value has been >> escaped and in var_dump($attr->value) we got "foo&bar". For fix this >> bug we must remove escaping. This is right? >> >> >> Second, for remove escaping I think we need use this patch: >> >> Index: attr.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- attr.c =A0 =A0 =A0(revision 294790) >> +++ attr.c =A0 =A0 =A0(working copy) >> @@ -193,7 +193,7 @@ >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0convert_to_string(newval); >> =A0 =A0 =A0 =A0} >> >> - =A0 =A0 =A0 xmlNodeSetContentLen((xmlNodePtr) attrp, Z_STRVAL_P(newval= ), >> Z_STRLEN_P(newval) + 1); >> + =A0 =A0 =A0 xmlNodeAddContentLen((xmlNodePtr) attrp, Z_STRVAL_P(newval= ), >> Z_STRVAL_P(newval) + 1); >> >> =A0 =A0 =A0 =A0if (newval =3D=3D &value_copy) { >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0zval_dtor(newval); >> >> >> This patch fix this cases: >> $attr =3D new DOMAttr('test', 'foo&bar'); >> var_dump($attr->value); >> $attr->value =3D "foo&bar"; >> var_dump($attr->value); >> >> but in this case we got empty value: >> $doc =3D new DOMDocument; >> $attr =3D $doc->createAttribute("foo"); >> $attr->value =3D "foo&bar"; >> var_dump($attr->value); >> >> Can you explain why? >> in first two cases wiil be call xmlNewProp libxml2 function, in last >> case - xmlNewDocProp. Both this functions return same variable type. >> >> > > The patch is incorrect as its changing the wrong thing. The retrieval of = the > value is correct, it's the setting which has an issue. Setting the value > using the value property should behave like setting the value via the > DOMAttr constructor - input should be treated as literal text. Wont be > changing the behavior of the value property due to BC. > > Rob > > -- Evgeniy