braintree / braintree_php

Braintree PHP library
https://developer.paypal.com/braintree/docs/start/overview
MIT License
546 stars 224 forks source link

Error while trying to search transaction by id #254

Closed SpinyMan closed 5 years ago

SpinyMan commented 5 years ago

General information

Issue description

I am trying to search transaction by id and get an error.

Braintree\IsNode has a method toParam() (camelCase) but Braintree\TransactionGateway method search trying to call toparam() (lowercase):

public function search($query)
{
    $criteria = [];
    foreach ($query as $term) {
        $criteria[$term->name] = $term->toparam();
    }
    ...

Could you please fix it ASAP?

hollabaq86 commented 5 years ago

Hi @SpinyMan I'm unable to reproduce your issue. Can you share a reproducible example and the error message you're getting? This part of the SDK hasn't been changed recently, and we haven't received similar reports from other merchants, so we're curious how this issue is manifesting for you.

crookedneighbor commented 5 years ago

Did some digging, and it looks like PHP function names are not case sensitive: https://tutorialsclass.com/faq/is-php-a-case-sensitive-language

In PHP, Variable names are case-sensitive but function names are not case sensitive.

Explanation:

If you defined variable in lowercase, then you need to use it in lowercase everywhere in program. If we define a variable $name = "James"; then we must need to use $name. $NAME will not work If you defined function name in lowercase, but calling them in uppercase it will work. For example, If we define function sum() {} then calling SUM() will also work.

What version of PHP are you running? Has that behavior changed recently?