hellosign / hellosign-php-sdk

A PHP SDK for HelloSign's API
MIT License
85 stars 38 forks source link

Deprecated: curl_setopt_array() #4

Closed itsazzad closed 8 years ago

itsazzad commented 9 years ago

Deprecated: curl_setopt_array(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in /vendor/hellosign/hellosign-php-sdk/library/lib/CURL.php on line 122

cmpaul commented 9 years ago

Thanks for the heads up, itsazzad. We'll update this issue as soon as we're able to push a fix for it (or feel free to create a pull request).

itsazzad commented 9 years ago

@cmpaul is there any update by this time?

cmpaul commented 9 years ago

@itsazzad Not yet, it's in our backlog, but will be sure to tag you when this gets fixed.

ghost commented 9 years ago

This isn't a proposed final solution, but it should work as a quick fix for anyone that needs it. These changes are based off the latest commit to the v3 branch (f8e608d29827a4e310b836f40ec8b9a854c7b473)

CURL.php

The function to_1_level_array needs this line:

if (is_array($value) || is_object($value)) {

changed to:

if (is_array($value) || (is_object($value) && get_class($value) != "CURLFile")) {

The to_1_level_array function is incorrectly flattening the CURLFile object, so the updated line will prevent that from happening.

SignatureRequest.php

In the addFile function, this line:

$f = new CURLfile($file);

needs to be changed to:

$f = new \CURLfile($file);

This just fixes a namespace issue.

This is working for me with php 5.5.

chocolatethunder commented 9 years ago

I changed

$f = new CURLfile($file);

to

$f = new CURLFile($file);

and it gives me this error:

Fatal error: Class 'HelloSign\CURLFile' not found in _snip_composer\vendor\hellosign\hellosign-php-sdk\library\HelloSign\SignatureRequest.php on line 211

Then I adjusted the code to look like this:

$finfo = finfo_open(FILEINFO_MIME_TYPE);
$finfo = finfo_file($finfo, $file);
$f = new \CURLFile($file, $finfo, basename($file));

Then I get this error:

Fatal error: Uncaught HelloSign\Error: [bad_request] Invalid parameter: file thrown in _snip_composer\vendor\hellosign\hellosign-php-sdk\library\HelloSign\Client.php on line 740

Then I made the fixes suggested by marcjaramillo, in test mode, the API is not getting anything. I am getting an unknown error.

suhelvidooly commented 8 years ago

Fatal error: Uncaught HelloSign\Error: [bad_request] Must specify file(s) to be sent. thrown in /var/www/ebs/mcn/digitalsignature/vendor/hellosign/hellosign-php-sdk/library/HelloSign/Client.php on line 912

desmondw commented 8 years ago

Implemented.