Skip to content

Base->toArray() expects array instead of null #336

@asdfklgash

Description

@asdfklgash

General information

  • SDK/Library version: 6.9 and also 6.15
  • Environment: production (think sandbox also)
  • Language, language version, and OS: PHP 8.0 on Linux

Issue description

[TypeError]
array_map(): Argument #2 ($array) must be of type array, null given

Exception trace:
at /var/www/vendor/braintree/braintree_php/lib/Braintree/Base.php:101
array_map() at /var/www/vendor/braintree/braintree_php/lib/Braintree/Base.php:101
Braintree\Base->toArray() at /var/www/vendor/braintree/braintree_php/lib/Braintree/Base.php:97
Braintree\Base->Braintree{closure}() at n/a:n/a
array_map() at /var/www/vendor/braintree/braintree_php/lib/Braintree/Base.php:101
Braintree\Base->toArray() at /var/www/vendor/braintree/braintree_php/lib/Braintree/Base.php:97
Braintree\Base->Braintree{closure}() at n/a:n/a
array_map() at /var/www/vendor/braintree/braintree_php/lib/Braintree/Base.php:101
Braintree\Base->toArray() at ...

The problem occurs within your toArray() function when $this->_attributes is null as PHP expects array for array_map.
In our case the problem occurs with riskData->liabilityShift is null.
riskData->decisionReasons is an empty array for example and that works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions