help with php bug #47532
| From: | Sokolov Evgeniy | Date: | Sat, 13 Feb 2010 08:29:29 +0000 |
| Subject: | help with php bug #47532 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-46984@lists.php.net to get a copy of this message | ||
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.
--
--
Best regards