Patch simplexml-patch for SimpleXML related Bug #61877
Patch version 2012-04-30 20:58 UTC
Return to Bug #61877 |
Download this patch
Patch Revisions:
Developer: felipe@php.net
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index a379111..b8ef03d 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -258,7 +258,11 @@ static zval * sxe_prop_dim_read(zval *object, zval *member, zend_bool elements,
sxe = php_sxe_fetch_object(object TSRMLS_CC);
- if (!member || Z_TYPE_P(member) == IS_LONG) {
+ if (!member || (Z_TYPE_P(member) == IS_LONG || Z_TYPE_P(member) == IS_DOUBLE)) {
+ if (member && Z_TYPE_P(member) == IS_DOUBLE) {
+ ZVAL_LONG(&tmp_zv, (long) Z_DVAL_P(member));
+ member = &tmp_zv;
+ }
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
@@ -468,7 +472,12 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
sxe = php_sxe_fetch_object(object TSRMLS_CC);
- if (!member || Z_TYPE_P(member) == IS_LONG) {
+ if (!member || (Z_TYPE_P(member) == IS_LONG || Z_TYPE_P(member) == IS_DOUBLE)) {
+ if (member && Z_TYPE_P(member) == IS_DOUBLE) {
+ ZVAL_LONG(&tmp_zv, (long) Z_DVAL_P(member));
+ member = &tmp_zv;
+ }
+
if (sxe->iter.type != SXE_ITER_ATTRLIST) {
attribs = 0;
elements = 1;
|