On Wed, Mar 27, 2013 at 1:39 PM, Sam Hermans <s...@mujo.be> wrote:

> Hi,
>
> The rcf howto pushed me into mailing you guys to measure reaction.
>
> For a project i am working on i struggle a lot with the fact that
> $_SERVER['REMOTE_ADDRESS'] return policy is to prefer IPv6 over IPv4, and
> that gethostbyname prefers IPv4. It seems that the gethostbyname
>  function as used in php is deprecated, and that getnameinfo should be
> used.
>
> I think that in an age where we are finally getting the support of the
> *big* boys to start using IPv6 that php should be there and ready for them.
>
> I have never contributed to php core before, but i'm more than happy to
> take the lead on this one.
>
> Please let me know what you guys think, and thank you for your time.
>
> Kind regards,
> Sam Hermans
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
you mean REMOTE_ADDR? what SAPI are you using?
AFAIK REMOTE_ADDR (as most other $_SERVER variables) is coming from the
webserver itself:
http://lxr.php.net/xref/PHP_5_5/sapi/apache/mod_php5.c#254
http://lxr.php.net/search?q=REMOTE_ADDR&defs=&refs=&path=&hist=&project=PHP_5_5
I suppose it will contain whatever address your server received the request
(be that an ipv4 or ipv6 address).
on the other hand gethostbyname by definition returns an IPV4 address for
the given host.
this is the intended and documented behavior.
there is an open feature request (with a patch) for changing that behavior
to return IPv6 address:
https://bugs.php.net/bug.php?id=49493&edit=1

personally I think that we should introduce this feature without breaking
any BC, so a new function or a new optional argument should be added.



-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu

Reply via email to