php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74975 Incorrect xmlrpc serialization for classes with declared properties
Submitted: 2017-07-23 03:22 UTC Modified: 2017-10-04 20:20 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: gmblar+php at gmail dot com Assigned: nikic (profile)
Status: Closed Package: XMLRPC-EPI related
PHP Version: 7.2.0beta1 OS: MacOS 10.13
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [2017-07-23 03:22 UTC] gmblar+php at gmail dot com
Description:
------------
xmlrpc_encode and xmlrpc_encode_request works different if the properties $xmlrpc_type and $scalar are defined before assigning values to an object.

If the properties $xmlrpc_type and $scalar are defined, xmlrpc_encode* don't use the values for serialization.

Test script:
---------------
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';

$xml = xmlrpc_encode([
    'foo' => $foo,
    'bar' => $bar
]);
var_dump($xml);

Expected result:
----------------
<?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>

Actual result:
--------------
<?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>
     <struct>
      <member>
       <name>xmlrpc_type</name>
       <value>
        <string>base64</string>
       </value>
      </member>
      <member>
       <name>scalar</name>
       <value>
        <string>foobar</string>
       </value>
      </member>
     </struct>
    </value>
   </member>
  </struct>
 </value>
</param>
</params>

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-02 16:48 UTC] nikic@php.net
-Summary: Different serialization for classes +Summary: Incorrect xmlrpc serialization for classes with declared properties
 [2017-10-04 20:09 UTC] spagalax at yahoo dot com
Since i have updated php to 7.1.9 (build 2 sept 2017) i get this error.. not every time only from time to time. Is this a bug? I have searched everywhere for a solution but i didn't found one

Fatal error: Uncaught Error: XML-RPC doesn't support circular references in /var/website/classes/functions.php:46
 [2017-10-04 20:20 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2017-10-04 20:20 UTC] nikic@php.net
This bug has been fixed some time ago by https://github.com/php/php-src/commit/c2b8066efb2d661129058790fe4dc1b41de99093 -- I forgot to close the bug report.

@spagalax: That looks like an unrelated issue.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC