|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-05-21 00:55 UTC] neweracracker at gmail dot com
Description:
------------
I have downloaded a snapshot of php 5.3.7 (Revision: 311276) from windows.php.net/snapshots/ and I am using php.ini-production as my php.ini file
IPv6 is enabled in my machine.
Using Apache and running the test script I got "bool(false)"
Using nginx (with php fastcgi) and running the test script I got "resource(1) of type (stream)"
Running php from the cmd line and running the test script I got "resource(4) of type (stream)"
I think it is supposed to work with all situations.
Please attempt to reproduce and fix this bug.
Thank you.
Test script:
---------------
<?php
var_dump( @fsockopen('localhost',80) );
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 22:00:02 2025 UTC |
Then try reproducing with mysql listening in 127.0.0.1:3306 <?php var_dump( @fsockopen('localhost',3306) ); ?> If it connects then bug is fixed.Works here: Script: var_dump(fsockopen("localhost", 9876)); ncat -4 -k -l 9876 -v -v 15:22:42,3106124 httpd.exe 2504 TCP Reconnect 0:0:0:0:0:0:0:1:6660 -> 0:0:0:0:0:0:0:1:9876 SUCCESS Length: 0, seqnum: 0, connid: 0 15:22:42,8106355 httpd.exe 2504 TCP Reconnect 0:0:0:0:0:0:0:1:6660 -> 0:0:0:0:0:0:0:1:9876 SUCCESS Length: 0, seqnum: 0, connid: 0 15:22:42,8210523 httpd.exe 2504 TCP Connect 127.0.0.1:6661 -> 127.0.0.1:9876 SUCCESS Length: 0, mss: 1460, sackopt: 1, tsopt: 0, wsopt: 1, rcvwin: 8192, rcvwinscale: 8, sndwinscale: 8, seqnum: 0, connid: 0 15:22:42,8216731 httpd.exe 2504 TCP Disconnect 127.0.0.1:6661 -> 127.0.0.1:9876 SUCCESS Length: 0, seqnum: 0, connid: 0 So tries IPv6, fails, then tries IPv4. Now with a process listening on IPv6: ncat -6 -k -l 9876 -v -v 15:25:44,6140323 httpd.exe 2504 TCP Accept 0:0:0:0:0:0:0:1:6672 -> 0:0:0:0:0:0:0:1:9876 SUCCESS Length: 0, mss: 1440, sackopt: 1, tsopt: 0, wsopt: 1, rcvwin: 8192, rcvwinscale: 8, sndwinscale: 8, seqnum: 0, connid: 0 15:25:44,6238583 httpd.exe 2504 TCP Disconnect 0:0:0:0:0:0:0:1:6672 -> 0:0:0:0:0:0:0:1:9876 SUCCESS Length: 0, seqnum: 0, connid: 0 Tries with IPv6 and works the first time. As expected. The only normal case when "127.0.0.1" would work but not localhost with a service listening only with IPv4 is if the packet for the initial attempt with IPv6 would get dropped instead of the OS getting a RST packet back rejecting the connection.