0

I am working with Laravel 5.6 and using Braintree payment gateway sand box. but when I update my php version it is encounters some error. like this

Function create_function() is deprecated
in Util.php line 206
at HandleExceptions->handleError(8192, 'Function create_function() is deprecated', 'C:\\Users\\mala\\Desktop\\ddddd\\vendor\\braintree\\braintree_php\\lib\\Braintree\\Util.php', 206, array('string' => 'client_token', 'delimiter' => '-', 'callbacks' => array()))in Util.php line 206 

so, I am using braintree vertion, ``` "oureastudios/laravel5-braintree": "dev-master" `` but when I search in internet most people suggested update braintree dependancy to v3.26.0. then My problem is how can I update My current braintree to above new vertion?

Muru
  • 217
  • 5
  • 20
  • you have to check for the braintree sdk along with the composer on the laravel directory or project directory. You need check for the update as per the laravel version – PHP Geek Nov 29 '18 at 05:13
  • actually I do not need update laravel version only new braintree version – Muru Nov 29 '18 at 05:15
  • We also need to check the supported version for the braintree, that the new version is supportable to the current laravel version or not. – PHP Geek Nov 29 '18 at 05:22
  • No, any solutions here – Muru Nov 29 '18 at 06:00
  • There is might help [Function create_function() is Deprecated in PHP 7.2 - How to Migrate?](https://www.tomasvotruba.cz/blog/2018/12/17/function-create-function-is-deprecated-in-php-72-how-to-migrate/) – Tomas Votruba Dec 18 '18 at 01:16
  • Possible duplicate of [PHP 7.2 Function create\_function() is deprecated](https://stackoverflow.com/questions/48161526/php-7-2-function-create-function-is-deprecated) – Tomas Votruba Dec 18 '18 at 01:16

1 Answers1

0

create_function is deprecated in PHP 7.2

in the file /Braintree/Util.php the function delimiterToCamelCase

Use:

$callback = function ($matches) {
                return strtoupper($matches[1]);
            };

instead of:

$callback = create_function('$matches', 'return strtoupper($matches[1]);');

Link Reference: https://github.com/braintree/braintree_php/commit/37e54736ef949cc022a3f87a9fed53820b798c3e

Ronny Morán
  • 557
  • 6
  • 10