summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2017-08-02 18:49:48 +0200
committerNikita Popov <nikita.ppv@gmail.com>2017-08-02 18:50:04 +0200
commit4988e83fe94b7977188476f12846d8b3263893d7 (patch)
tree2f9a5a34b6769e8154aaa20f95bab29b9a299f2c /ext
parent9871555090a661744505b549d4f808b5e4366e37 (diff)
parentc2b8066efb2d661129058790fe4dc1b41de99093 (diff)
downloadphp-git-4988e83fe94b7977188476f12846d8b3263893d7.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
Diffstat (limited to 'ext')
-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 3663913019..9be6349f58 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 {