Kong / unirest-php

Unirest in PHP: Simplified, lightweight HTTP client library.
http://unirest.io/php
MIT License
1.28k stars 328 forks source link

Trying to access array offset on value of type int #143

Open jackzp opened 4 years ago

jackzp commented 4 years ago

if url have port in it , php will have this error

$url = "http://localhost:3000"; $response = Unirest\Request::get($url, $headers);

A PHP Error was encountered Severity: Notice

Message: Trying to access array offset on value of type int

Filename: Unirest/Request.php

Line Number: 555

Backtrace:

File: /Users/jack/Documents/html/vendor/mashape/unirest-php/src/Unirest/Request.php Line: 555 Function: _error_handler

File: /Users/jack/Documents/html/vendor/mashape/unirest-php/src/Unirest/Request.php Line: 417 Function: encodeUrl

File: /Users/jack/Documents/html/vendor/mashape/unirest-php/src/Unirest/Request.php Line: 236 Function: send

Amurmurmur commented 4 years ago

+1

loverg-c commented 4 years ago

+1 since upgrade to php 7.4

loverg-c commented 4 years ago

I just createed a pull request for this one,

If you use composer, you can add/change your composer.json with this : mashape/unirest-php": "^3.0.5", or mashape/unirest-php": "dev-master", then add

 "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/loverg-c/unirest-php"
        }
    ],

and finally composer update

amaraa019 commented 4 years ago

I just createed a pull request for this one,

If you use composer, you can add/change your composer.json with this : mashape/unirest-php": "^3.0.5", or mashape/unirest-php": "dev-master", then add

 "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/loverg-c/unirest-php"
        }
    ],

and finally composer update

Thank you so much. You're genius

senter-logistics commented 4 years ago

i got this error with php 7.4. Try to downgrade to 7.3

Vahanerevan commented 3 years ago

+1