diff options
author | Andreas Treichel <gmblar+github@gmail.com> | 2017-07-23 05:29:18 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-08-02 18:49:26 +0200 |
commit | c2b8066efb2d661129058790fe4dc1b41de99093 (patch) | |
tree | ac8d8bebc207b61c08dd90881b01be1ff4930aa3 /ext/xmlrpc | |
parent | 9ca1b2a775bd791896f2d8e365cdb94b81c46060 (diff) | |
download | php-git-c2b8066efb2d661129058790fe4dc1b41de99093.tar.gz |
Bug #74975: Different serialization for classes
Diffstat (limited to 'ext/xmlrpc')
-rw-r--r-- | ext/xmlrpc/tests/bug74975.phpt | 56 | ||||
-rw-r--r-- | ext/xmlrpc/xmlrpc-epi-php.c | 4 |
2 files changed, 58 insertions, 2 deletions
diff --git a/ext/xmlrpc/tests/bug74975.phpt b/ext/xmlrpc/tests/bug74975.phpt new file mode 100644 index 0000000000..8f6a9dfb13 --- /dev/null +++ b/ext/xmlrpc/tests/bug74975.phpt @@ -0,0 +1,56 @@ +--TEST-- +Bug #74975 Different serialization for classes +--SKIPIF-- +<?php +if (!extension_loaded("xmlrpc")) print "skip"; +?> +--FILE-- +<?php + +class Foo { + +} + +class Bar { + + public $xmlrpc_type; + public $scalar; + +} + +$foo = new Foo(); +$foo->xmlrpc_type = 'base64'; +$foo->scalar = 'foobar'; + +$bar = new Bar(); +$bar->xmlrpc_type = 'base64'; +$bar->scalar = 'foobar'; + +echo xmlrpc_encode([ + 'foo' => $foo, + 'bar' => $bar +]); + +?> +--EXPECTF-- +<?xml version="1.0" encoding="utf-8"?> +<params> +<param> + <value> + <struct> + <member> + <name>foo</name> + <value> + <base64>Zm9vYmFy </base64> + </value> + </member> + <member> + <name>bar</name> + <value> + <base64>Zm9vYmFy </base64> + </value> + </member> + </struct> + </value> +</param> +</params> diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index 4704926053..6b6cf41817 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -1354,7 +1354,7 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */ zval* attr; type = xmlrpc_vector; - if ((attr = zend_hash_str_find(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1)) != NULL) { + if ((attr = zend_hash_str_find_ind(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1)) != NULL) { if (Z_TYPE_P(attr) == IS_STRING) { type = xmlrpc_str_as_type(Z_STRVAL_P(attr)); } @@ -1368,7 +1368,7 @@ XMLRPC_VALUE_TYPE get_zval_xmlrpc_type(zval* value, zval* newvalue) /* {{{ */ zval* val; if ((type == xmlrpc_base64 && Z_TYPE_P(value) == IS_OBJECT) || type == xmlrpc_datetime) { - if ((val = zend_hash_str_find(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR) - 1)) != NULL) { + if ((val = zend_hash_str_find_ind(Z_OBJPROP_P(value), OBJECT_VALUE_ATTR, sizeof(OBJECT_VALUE_ATTR) - 1)) != NULL) { ZVAL_COPY_VALUE(newvalue, val); } } else { |