braintree / braintree_php

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

Fix 'Warning: Parameter 1 to end() expected to be a reference' #210

Closed kkuuko closed 6 years ago

kkuuko commented 6 years ago

When you try to upload file you get this warning 'Warning: Parameter 1 to end() expected to be a reference, value given.' and after that you get the error:

Fatal error: Uncaught Braintree\Exception\ServerError in /var/www/vendor/braintree/braintree_php/lib/Braintree/Util.php:71
Stack trace:
#0 /var/www/vendor/braintree/braintree_php/lib/Braintree/Http.php(61): Braintree\Util::throwStatusCodeException(500)
#1 /var/www/vendor/braintree/braintree_php/lib/Braintree/DocumentUploadGateway.php(62): Braintree\Http->postMultipart('/merchants/968p...', Array, Resource id #21)
#2 /var/www/vendor/braintree/braintree_php/lib/Braintree/DocumentUpload.php(35): Braintree\DocumentUploadGateway->create(Array)
#3 /var/www/test.php(14): Braintree\DocumentUpload::create(Array)
#4 {main}
  thrown in /var/www/vendor/braintree/braintree_php/lib/Braintree/Util.php on line 71

The parameters for call_user_func() are not passed by reference and the variable $filePath is NULL.

Summary

Remove call_user_func() and directly call the function end().

Checklist