summaryrefslogtreecommitdiff
path: root/ext/xmlrpc
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2017-08-02 18:50:10 +0200
committerNikita Popov <nikita.ppv@gmail.com>2017-08-02 18:50:18 +0200
commitaa925cb0adef9de9a237d726463b78a7998b50e7 (patch)
treeb4aa8e156adbac990cbdd2488ee76467a5e821db /ext/xmlrpc
parent042ff13ca94b71a7b72bd0d082f47d5b90c2eb26 (diff)
parent4988e83fe94b7977188476f12846d8b3263893d7 (diff)
downloadphp-git-aa925cb0adef9de9a237d726463b78a7998b50e7.tar.gz
Merge branch 'PHP-7.1' into PHP-7.2
Diffstat (limited to 'ext/xmlrpc')
-rw-r--r--ext/xmlrpc/tests/bug74975.phpt56
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c4
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&#10;</base64>
+ </value>
+ </member>
+ <member>
+ <name>bar</name>
+ <value>
+ <base64>Zm9vYmFy&#10;</base64>
+ </value>
+ </member>
+ </struct>
+ </value>
+</param>
+</params>
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index 4a6fbb0c12..2b1a642c05 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 {