Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46986 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18365 invoked from network); 14 Feb 2010 13:18:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Feb 2010 13:18:29 -0000 Authentication-Results: pb1.pair.com header.from=rrichards@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rrichards@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 207.58.142.213 as permitted sender) X-PHP-List-Original-Sender: rrichards@php.net X-Host-Fingerprint: 207.58.142.213 smtp2go.com Linux 2.6 Received: from [207.58.142.213] ([207.58.142.213:52665] helo=smtp2go.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 60/C5-03903-328F77B4 for ; Sun, 14 Feb 2010 08:18:28 -0500 Received: from [67.158.171.203] (helo=Rob-Richardss-MacBook-Pro.local) by smtp2go.com with esmtp (Exim 4.69) (envelope-from ) id 1NgeMd-0007Az-Ow; Sun, 14 Feb 2010 13:18:19 +0000 Message-ID: <4B77F81C.5080609@php.net> Date: Sun, 14 Feb 2010 08:18:20 -0500 User-Agent: Thunderbird 2.0.0.23 (Macintosh/20090812) MIME-Version: 1.0 To: Sokolov Evgeniy CC: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SMTP2Go-MailScanner-Information: Please contact support@smtp2go.com for more information X-SMTP2Go-MailScanner-ID: 1NgeMd-0007Az-Ow X-SMTP2Go-MailScanner: Found to be clean X-SMTP2Go-MailScanner-From: rrichards@php.net Subject: Re: help with php bug #47532 From: rrichards@php.net (Rob Richards) Sokolov Evgeniy wrote: > Hi, I wont fix this bug: http://bugs.php.net/bug.php?id=47532, 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 = "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 > =================================================================== > --- attr.c (revision 294790) > +++ attr.c (working copy) > @@ -193,7 +193,7 @@ > convert_to_string(newval); > } > > - xmlNodeSetContentLen((xmlNodePtr) attrp, Z_STRVAL_P(newval), > Z_STRLEN_P(newval) + 1); > + xmlNodeAddContentLen((xmlNodePtr) attrp, Z_STRVAL_P(newval), > Z_STRVAL_P(newval) + 1); > > if (newval == &value_copy) { > zval_dtor(newval); > > > This patch fix this cases: > $attr = new DOMAttr('test', 'foo&bar'); > var_dump($attr->value); > $attr->value = "foo&bar"; > var_dump($attr->value); > > but in this case we got empty value: > $doc = new DOMDocument; > $attr = $doc->createAttribute("foo"); > $attr->value = "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