braintree/braintree_php_example

PHP 7.2 "Choose a way to pay" box is missing on index.php

Closed this issue · 3 comments

General information

  • Environment: Sandbox
  • Language, language version, and OS: PHP 7.2 running on macOS High Sierra 10.13.3

Issue description

I followed the Setup Instructions in README.md 1-4 and am successfully presented with "Hi, Let's test a transaction" index.php page. However, there is only an Amount box (default $10) ("Choose a way to pay" box is missing). Clicking 'Test Transaction' gives the error

Error: 91508: Cannot determine payment method.

Screenshot with PHP 7.2:
screen shot 2018-04-02 at 4 04 17 pm

Downgrading to PHP <7.2 successfully shows the "Choose a way to pay" box below the Amount box.

Screenshot with PHP 7.1.14:
screen shot 2018-04-02 at 4 03 43 pm

Additional information:

When I am running the internal PHP server with PHP 7.2, it keeps throwing:

PHP Deprecated: Function create_function() is deprecated in /Users/projects/braintree_php_example/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 203

Temporary proposed solution

We could update composer.json from:

  "require" : {
   ...
    "php": ">=5.2.1",
   ...
  },

to:

  "require" : {
   ...
    "php": ">=5.2.1 <7.2",
   ...
  },

Hope this makes sense!

  • Dan

This was fixed in braintree_php v3.26.0 and we just never upgraded the sdk in the repo.

I've opened a PR at #38 to do that and include explicit testing for php v7.2 in the Travis build.

This is fixed on master now. Want to give it a try?

Confirmed working for me, with no errors, with PHP 7.2.3. Thank you!