简体   繁体   English

is_object() authorize.net 之前不可见的 \  字符

[英]Invisible \u00A0 character before is_object() authorize.net

I am using the sample code from the PHP SDK and the package throws an error of我正在使用 PHP SDK 中的示例代码,并且该包抛出了一个错误

Call to undefined function net\\authorize\\api\\contract\\v1\\ is_object().调用未定义的函数 net\\authorize\\api\\contract\\v1\\is_object()。

It looks like its coming from this call:看起来它来自这个电话:

$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);

That in turns calls this:这反过来称之为:

vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/CreateTransactionResponse.php:72

I saw an issue open on their Github page that's been around for a bit now.我在他们的 Github 页面上看到一个问题,这个问题已经存在一段时间了。 Anyone else seen this?还有人看到这个吗? How can you fix this if its coming from the actual vendors code?如果它来自实际的供应商代码,你如何解决这个问题?

Using their API directly, not through the SDK, the response had three invisible characters at the start.直接使用他们的 API,而不是通过 SDK,响应一开始就有三个不可见的字符。 Since it is a JSON response, I created a loop that would remove the starting character until a opening bracket is encountered.由于它是一个 JSON 响应,我创建了一个循环来删除起始字符,直到遇到左括号。 You may be able to fix their SDK with something similar.您可以使用类似的方法修复他们的 SDK。

    while ('{' !== $cleaned_response[0]) {
        $cleaned_response = substr($cleaned_response, 1);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM