xmlrpcmsg :: serialize()不会将params放入序列化的有效负载中

时间:2017-08-01 09:50:22

标签: php xml serialization xml-rpc

我们使用php xmlrpc库对电子邮件提供商执行xml rpc请求。

然而,当在新环境(php 5.6而不是5.3)上测试这些功能时,这些功能总是有效的。在调用xmlrpcmsg :: serialize()时,xmlrpcmsg似乎不会在参数值中构建。当var_dump对象时,即使params显然存在。

我加入图书馆的方式是包括xmlrpc.inc(// Copyright(c)1999,2000,2002 Edd Dumbill。)虽然我找不到任何可能告诉我有关任何扩展的文档是必需的或PHP版本兼容性。

示例:

$this->msg = new xmlrpcmsg(
                    "contact.transactional", array(
                        // carer details
                        new xmlrpcval(
                            array(
                                "carer_id" => new xmlrpcval($data['Carer_ID'], "string"),
                                "email" => new xmlrpcval($data['CarerEmail'], "string"),
                            ), "struct"
                        ),
                        // campaign_id to be launched
                        new xmlrpcval($trigger['trigger_id'], "int"),
                        // transactional data to be passed into email template
                        new xmlrpcval(
                            array(
                                "carer_id" => new xmlrpcval($data['Carer_ID'], "int"), 
                                "baby_id" => new xmlrpcval($data['Baby_ID'], "string"),
                                "carer_email" => new xmlrpcval($data['CarerEmail'], "string"), 
                            ), "struct"
                        ),
                    )
                );

当我在本地系统/已经存在的服务器上var_dump $this->msg->serialize()

<methodcall>
<methodname>contact.transactional</methodname>
<params>
    <param>
    <value>
        <struct>
            <member>
                <name>email</name>
                <value>
                    <string>adam+testest@testest.co.uk</string>
                </value>
            </member>
        </struct>
    </value>
    <param>
    <value>
        <int>17458</int>
    </value>
    <param>
    <value>
        <struct>
            <member>
                <name>carer_id</name>
                <value>
                    <string>654321</string>
                </value>
            </member>
            <member>
                <name>baby_id</name>
                <value>
                    <string>123456</string>
                </value>
            </member>
            <member>
                <name>carer_email</name>
                <value>
                    <string>adam+testest@testest.co.uk</string>
                </value>
            </member>
        </struct>
    </value>
</params>
</methodcall>

当我在新测试服务器上var_dump $this->msg->serialize()

<methodcall>
<methodname>contact.transactional</methodname>
<params>
    <param>
    <value></value>
    <param>
    <value></value>
    <param>
    <value></value>
</params>
</methodcall>

1 个答案:

答案 0 :(得分:1)

看起来我只需要将库更新到最新版本phpxmlrpc at github