Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization of 'CURLFile' is not allowed #87

Closed
afunnydev opened this issue Nov 17, 2020 · 5 comments
Closed

Serialization of 'CURLFile' is not allowed #87

afunnydev opened this issue Nov 17, 2020 · 5 comments
Assignees
Labels

Comments

@afunnydev
Copy link

Hello! I am using this extension to post a file to and endpoint during a CraftCMS Hook. To do so, I use a CURLFile in my body.

$headers = [
    'Authorization' => 'Bearer BlaBla',
];

$data = [
    'file' => new \CURLFile ( '/my/path', 'image/png', 'filename.png' ),
];

$curl = new curl\Curl();
$response = $curl->setRawPostData($data)->setHeaders($headers)->post($url);

Everything works well. However, when in development (i.e YII_DEBUG = true), I error with Serialization of 'CURLFile' is not allowed since the extension tries to serialize the CURLOPT_POSTFIELDS for debugging. I cannot redefine YII_DEBUG. Is there any way to opt out of debugging?

@nicolicioiul
Copy link

Confirmed on php 7.4

@linslin linslin self-assigned this Dec 1, 2020
@linslin linslin added the bug label Dec 1, 2020
@linslin
Copy link
Owner

linslin commented Dec 1, 2020

Hey guys,

thanks for your reporting. I will take a look on it in the next days.

@linslin
Copy link
Owner

linslin commented Feb 2, 2021

Depending: mcustiel/phiremock-codeception-extension#42 (For PHP 8 Update)

@linslin
Copy link
Owner

linslin commented Feb 2, 2021

I will add a fix for this in the next version, which will also have PHP 8.0 Support. Meanwhile disable the debug mode in your web/index.php file:

defined('YII_DEBUG') or define('YII_DEBUG', false);

@linslin
Copy link
Owner

linslin commented Feb 20, 2021

Version 1.5.0 with PHP 8 support was just released: https://github.com/linslin/Yii2-Curl/releases/tag/1.5.0

Thanks for your help!

@linslin linslin closed this as completed Feb 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants