twitter-async icon indicating copy to clipboard operation
twitter-async copied to clipboard

Localhost check doesn't work correctly with IPV6 server name '::1' - results in Uncaught exception 'EpiTwitterException'

Open alex-gonzalez opened this issue 11 years ago • 3 comments

When using the library on my local machine with IPV6 the check for localhost in EpiOAuth isn't triggered because $_SERVER['SERVER_ADDR'] is '::1'

I changed line 171 in EpiOAuth from: if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] != '127.0.0.1')

to: if(isset($_SERVER ['SERVER_ADDR']) && !empty($_SERVER['SERVER_ADDR']) && $_SERVER['SERVER_ADDR'] != '127.0.0.1' && $_SERVER['SERVER_ADDR'] != '::1')

This may be useful to other developers working on their local machine and getting this exception.

alex-gonzalez avatar Feb 24 '14 22:02 alex-gonzalez

Care to submit this as a pull request?

jmathai avatar Feb 27 '14 01:02 jmathai

Here you go: https://github.com/jmathai/twitter-async/pull/199

alex-gonzalez avatar Feb 27 '14 18:02 alex-gonzalez

Got the same problem here, localhost with IPv6. I've tried the proposed solution and it works. Please accept the PR.

cmoralesweb avatar Jan 08 '15 09:01 cmoralesweb