ID:               48131
 User updated by:  dvasseur at diway dot net
 Reported By:      dvasseur at diway dot net
-Status:           Feedback
+Status:           Open
 Bug Type:         Streams related
 Operating System: Linux - Ubuntu 8.10
 PHP Version:      5.2.9
 New Comment:

Same bug with CVS snapshot
--
PHP 5.2.10-dev (cli) (built: May  2 2009 21:22:25) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
--


Previous Comments:
------------------------------------------------------------------------

[2009-05-02 18:36:44] [email protected]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/



------------------------------------------------------------------------

[2009-05-02 13:30:45] dvasseur at diway dot net

Description:
------------
My system has 2 ip addresses, one ipv4 (A.B.C.D) and the other ipv6
(1:2:3:4:5:6)

I'm trying to open a file over HTTP (http://other.server/my.file.dat),
'other.server' is resolving both on ipv4 and ipv6 too.

I'd like to choose wether IPv4 or IPv6 to open the file so I'm using
stream_context_create() with the 'bindto' option.

'bindto' with an ipv4 address is NOT working
'bindto' with an ipv6 address is working


Reproduce code:
---------------
The following code is working (ipv6 is used)
--
$opts = array(
  'socket' => array(
      'bindto' => '[1:2:3:4:5:6]:0',
  ),
);

$context = stream_context_create($opts);

$contents = file_get_contents('http://other.server/my.file.dat', FALSE,
$context);
--

The following code is NOT working:
--
$opts = array(
  'socket' => array(
      'bindto' => 'A.B.C.D:0',
  ),
);

$context = stream_context_create($opts);

$contents = file_get_contents('http://other.server/my.file.dat', FALSE,
$context);
--

=> PHP Warning:  file_get_contents(): Invalid IP Address: A.B.C.D 

Expected result:
----------------
ipv4 working

Actual result:
--------------
ipv4 NOT working


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48131&edit=1

Reply via email to