douheng8629 2017-08-14 14:47 采纳率: 100%
浏览 38

php boolean value as argument抛出编码错误

When I try to put a boolean value as a parameter in a functionc call, I get that I am missing a property

// try to get orders
try {
    $order = new Order($auth_login, $auth_password, $live_mode);
    $orders = $order->findOrdersBySubscriptionId($sessionId, $subscriptionId, (bool) false);
} catch (Exception $e) {
    var_dump($e);
}

This gives this error:

SoapFault Object
(
    [message:protected] => SOAP-ERROR: Encoding: object has no 'onlyOnGoing' property
        Array
            (
                [0] => Array
                    (
                        [Session] => 12345
                        [SubscriptionId] => 30520
                        [OnlyOnGoing] => 
                    )

            )

    )

)

I have also tried (instead of (bool) false):

FALSE, False, false

None work!

EDIT:

I looked through Orders and found this part:

public function findOrdersBySubscriptionId($session, $subscriptionId, $onlyOnGoing) {
    try {
        $result = $this->client->findOrdersBySubscriptionId(array("Session" => $session, "SubscriptionId" => $subscriptionId, "OnlyOnGoing" => $onlyOnGoing));
        return $result;
    } catch (Except $e) {
        return array("Error" => $e->getMessage());
    }
}

Where I changed "onlyOnGoing" => $onlyOnGoing to "OnlyOnGoing" => $onlyOnGoing.

Now I get this error (I also changed output from print_r to var_dump):

object(SoapFault)#2668 (10) {
["message":protected]=>
string(58) "SOAP-ERROR: Encoding: object has no 'onlyOnGoing' property"
["trace":"Exception":private]=>
array(6) {
    [0]=>
    array(6) {
        [0]=>
        string(26) "findOrdersBySubscriptionId"
        [1]=>
        array(1) {
        [0]=>
        array(3) {
            ["Session"]=>
            string(36) "4D398084-9B08-38A3-362E-880111364DD8"
            ["SubscriptionId"]=>
            int(30520)
            ["OnlyOnGoing"]=>
            bool(false)
        }
        }
    }
    }
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 软件测试决策法疑问求解答
    • ¥15 win11 23H2删除推荐的项目,支持注册表等
    • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
    • ¥15 qt6.6.3 基于百度云的语音识别 不会改
    • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
    • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
    • ¥15 lingo18勾选global solver求解使用的算法
    • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行