php-http / curl-client

cURL client
http://httplug.io
MIT License
443 stars 28 forks source link

PHP 7.2: Failure evaluating code: is_resource($handle) #36

Closed samuelnogueira closed 6 years ago

samuelnogueira commented 6 years ago

In src/PromiseCore.php:79, there are 2 assertions as string:

        assert('is_resource($handle)');
        assert('get_resource_type($handle) === "curl"');

This behavior is deprecated in PHP 7.2 (see http://php.net/manual/en/function.assert.php).

samuelnogueira commented 6 years ago

Since this library supports both PHP 5 and 7, and assertions as language construct exist only since version 7.0, I'm not sure what's the best course of action here, should the library stop supporting PHP 5? Or should assertions be rewritten as if (...) { throw exception }?

samuelnogueira commented 6 years ago

@mekras I didn't mean to overstep, I just already had a working fix that I would like to share with you and the other contributors if it somehow saves you guys work.

Nyholm commented 6 years ago

No worries. I would say this is perfect behavior to write an issue and then create a fix for it. I promise @mekras is super happy that you added a PR.

mekras commented 6 years ago

Version 1.7.1 released.