Page 1 of 1
PayPal module ((Powered by Braintree) Bugs
Posted: Sun Jul 08, 2018 7:10 pm
by C4Y
Hi,
I don't find solution for this problem :
I'm activing PayPal module ((Powered by Braintree) on Opncart 3.0.2.0 )
When the cusommer buy an article, and click on "passed command", the page "checkout" is bloked.
On debug, we can read this :
Thanks for some idea and help
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Mon Jul 09, 2018 10:48 pm
by straightlight
What are the Braintree logs showing when enabling the debug mode? You can send the report over PM if you'd like. I just helped a forum user about Braintree as we speak with the same OC version and no issue as such was encountered so far.
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Mon Jul 09, 2018 11:46 pm
by C4Y
Hello,
Thank you for your answers.
I have two errors :
PHP Unknown: Function create_function() is deprecated in /var/www/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 205
PHP Unknown: Function create_function() is deprecated in /var/www/storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 172
My server uses Apache 2.4 http2 and php 7.2
Thank you for help
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Tue Jul 10, 2018 12:10 am
by straightlight
Finally, real true clues!
Due to the PHP requirements of OC for v7.1 and above, I think it is important to also focus on these issues reported above in accordance to:
https://stackoverflow.com/questions/481 ... deprecated.
In vendor/braintree/braintree_php/lib/Braintree/Util.php file, find:
Code: Select all
$callback = create_function('$matches', 'return strtoupper($matches[1]);');
replace with:
Code: Select all
$callback = function($matches) use ($callback) {
return $callback . strtoupper($matches[1]);
}
Then, find:
Code: Select all
$callbacks[$delimiter] = create_function('$matches', "return '$delimiter' . strtolower(\$matches[1]);");
replace with:
Code: Select all
$callbacks[$delimiter] = function($matches) use ($delimiter) {
return $delimiter . strtolower($matches[1]);
}
Then, not to forget these steps:
viewtopic.php?f=176&p=728050#p725084
This should clarify the issue.
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Tue Jul 10, 2018 12:25 am
by straightlight
Another clue found in vendor/braintree/braintree_php/tests/integration/Error/ValidationErrorCollectionTest.php file,
find:
Code: Select all
$codes = array_map(create_function('$validationError', 'return $validationError->code;'), $validationErrors);
replace with:
Code: Select all
$codes = array_map(function($matches) use ($validationError) { return $validationError->code; }, $validationErrors);
Re-use the same link from my previous post to refresh the changes.
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Tue Jul 10, 2018 3:53 am
by C4Y
Thank you, finally I preferred downgrade in PHP7.0
So, my problem is in the code that is in the table oc_theme :
How to regenerate this code?
Thanks
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Tue Jul 10, 2018 3:58 am
by straightlight
This row has been generated by an extension not originating from the core.
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Tue Jul 10, 2018 6:01 am
by C4Y
deleting lines in oc theme and it works
Tanks for help and good jobs all

Re: PayPal module ((Powered by Braintree) Bugs
Posted: Mon Oct 15, 2018 3:23 am
by letsdoit
Hi Guys,
I have also had the same issue with the PayPal (Powered by Braintree) Module in Opencart 3.0.2.0 running PHP v7.2. As my hosts provide either PHP 5.6 or 7.2, In the end I had to reinstall OC completely on PHP 5.6 and then the PayPal (Powered by Braintee) module worked fine!
Is there a simple fix for this? My hosts have recently stopped supporting PHP 5.3, so I assume 5.6 won't be far behind and then I have the problem all over again! Any ideas would be appreciated?
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Fri Jan 18, 2019 5:14 pm
by edwardr
Hi,
I have the same problem.
I tried the code changes but I get following error:
Parse error: syntax error, unexpected '}' in /xxx_storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 175
what happens when you delete the }
Parse error: syntax error, unexpected 'return' (T_RETURN) in /xxx_storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 177
I also tried the util file (if it is new) from the 3.0.3.1, but same errors like at the beginning…
PS: I refreshed / cleaned the cache
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Fri Jan 18, 2019 6:24 pm
by straightlight
edwardr wrote: ↑Fri Jan 18, 2019 5:14 pm
Hi,
I have the same problem.
I tried the code changes but I get following error:
Parse error: syntax error, unexpected '}' in /xxx_storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 175
what happens when you delete the }
Parse error: syntax error, unexpected 'return' (T_RETURN) in /xxx_storage/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 177
I also tried the util file (if it is new) from the 3.0.3.1, but same errors like at the beginning…
PS: I refreshed / cleaned the cache
PHP version?
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Sun Jan 20, 2019 9:31 am
by edwardr
also 7.2
(it worked at my old webhoster, but they had an older version)
thx for help
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Mon Jan 21, 2019 8:20 pm
by antonis.loizou
I am having the same issue, although my php version is 7.0.32 .
Code: Select all
Uncaught ReferenceError: braintree is not defined
at Object.success (<anonymous>:37:5)
at u (jquery-3.3.1.min.js:2)
at Object.fireWith [as resolveWith] (jquery-3.3.1.min.js:2)
at k (jquery-3.3.1.min.js:2)
at HTMLScriptElement.n (jquery-3.3.1.min.js:2)
at HTMLScriptElement.dispatch (jquery-3.3.1.min.js:2)
at HTMLScriptElement.y.handle (jquery-3.3.1.min.js:2)
This points to :
Code: Select all
$.getScript('https://js.braintreegateway.com/web/3.6.3/js/client.min.js', function() {
$.getScript('https://js.braintreegateway.com/web/3.6.3/js/hosted-fields.min.js');
$.getScript('https://js.braintreegateway.com/web/3.6.3/js/data-collector.min.js');
braintree.client.create({
authorization: 'XXXX'
}, function (client_error, braintree_client) {
console.log("Create Client");
if (client_error) {
console.error(client_error);
return;
}
client_instance = braintree_client;
braintree.hostedFields.create({
client: braintree_client,
styles: "{\n\t\t 'input': { 'font-size': '12px', 'font-family': 'Source Sans Pro, sans-serif', 'color': '#7A8494' },\n\t\t 'input.invalid': { 'color': 'red' },\n\t\t 'input.valid': { 'color': 'green' }\n\t \t}",
fields: {
number: {
selector: '#input-card-number',
placeholder: '1111 1111 1111 1111'
},
expirationMonth: {
selector: '#input-card-expiration-month',
placeholder: 'Month',
select: true
},
expirationYear: {
selector: '#input-card-expiration-year',
placeholder: 'Year',
select: true
},
cvv: {
selector: '#input-card-cvv',
placeholder: 'CVV2',
type: "password"
}
}
}, hostedCallback);
braintree.dataCollector.create({
client: braintree_client,
kount: true,
paypal: true
}, dataCollectorCallback);
});
});
I have refreshed cache and modifications , uninstalled the Paypal Express Checkout extension, uninstalled and reinstalled the PayPal powered by Braintree extension.
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Wed Jan 23, 2019 4:15 am
by straightlight
The error indicated above cannot be the same issue addressed from previous post since the provided error code and source of origin do not correspond to the same error message also since you are using PHP v7.0.32 while the previous user has state: PHP v7.2.
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Wed Jan 23, 2019 7:52 pm
by edwardr
I have 7.2 and the Errors in line 205 and 172

But when I Change it like you said the Computer says there is an unexpected {
I'm going to listen now Guns n' roses - Don't cry

Re: PayPal module ((Powered by Braintree) Bugs
Posted: Wed Jan 23, 2019 8:05 pm
by antonis.loizou
straightlight wrote: ↑Wed Jan 23, 2019 4:15 am
The error indicated above cannot be the same issue addressed from previous post since the provided error code and source of origin do not correspond to the same error message also since you are using PHP v7.0.32 while the previous user has state: PHP v7.2.
Understood - should I make a new topic then ? I am at a loss on how to debug this further, any pointers would be much appreciated
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Thu Jan 24, 2019 6:16 pm
by edwardr
antonis.loizou wrote: ↑Wed Jan 23, 2019 8:05 pm
straightlight wrote: ↑Wed Jan 23, 2019 4:15 am
The error indicated above cannot be the same issue addressed from previous post since the provided error code and source of origin do not correspond to the same error message also since you are using PHP v7.0.32 while the previous user has state: PHP v7.2.
Understood - should I make a new topic then ? I am at a loss on how to debug this further, any pointers would be much appreciated
yes, please
Re: PayPal module ((Powered by Braintree) Bugs
Posted: Tue Jan 29, 2019 5:16 pm
by edwardr
any News / ideas / Information

Re: PayPal module ((Powered by Braintree) Bugs
Posted: Thu Feb 07, 2019 11:05 pm
by edwardr
my provider gave me the possibility to change the php Version to 7.1. (now it works)
The error is caused by the Php Version 7.2, but I didn't found a solution. The change which was descriped before didn't worked

Re: PayPal module ((Powered by Braintree) Bugs
Posted: Mon Mar 04, 2019 4:53 am
by straightlight