Req #7132 [Asn->Csd]: fsockopen doesn't report dns lookup failure

From: Date: Tue, 30 Jul 2013 03:47:02 +0000
Subject: Req #7132 [Asn->Csd]: fsockopen doesn't report dns lookup failure
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-180558@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=7132&edit=1 ID: 7132 Updated by: yohgaki@php.net Reported by: kaufmann at cyland dot com Summary: fsockopen doesn't report dns lookup failure -Status: Assigned +Status: Closed Type: Feature/Change Request Package: Streams related Operating System: * PHP Version: 5.3 Assigned To: wez Block user comment: N Private report: N New Comment: It seems this is fixed. <?php $bogus = 'www.aasaaaaaaaaaaaaa.net'; fsockopen($bogus, 80, $errno, $errstr); echo $errno, "\n"; var_dump($errstr); ?> Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 4 Warning: fsockopen(): unable to connect to www.aasaaaaaaaaaaaaa.net:80 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in - on line 4 0 string(71) "php_network_getaddresses: getaddrinfo failed: Name or service not known" Previous Comments: ------------------------------------------------------------------------ [2010-12-01 15:45:39] jani@php.net errstr is set, errno isn't. ------------------------------------------------------------------------ [2005-08-11 19:11:59] nlopess@php.net BTW, the script I've provided leaks with or without my patch (with zend mm disabled)! The problematic part is the simple "echo $errno;". ------------------------------------------------------------------------ [2005-08-11 18:43:41] nlopess@php.net Wez, can you please take a look at my patch? http://mega.ist.utl.pt/~ncpl/php_7132_patch.txt test script: <? $bogus = 'www.aasaaaaaaaaaaaaa.net'; fsockopen($bogus, 80, $errno, $errstr); echo $errno, "\n"; var_dump($errstr); ?> This patch also fixes the problem of having two warnings generated, instead of just one. ------------------------------------------------------------------------ [2000-10-11 06:36:14] kaufmann at cyland dot com fsockopen doesn't report dns lookup failure in errno and errstr. It would be nice if this error was passed including a hint what is wrong with the call to fsockopen. Debugging of skripts using sockets would become easier. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=7132&edit=1

« previous php.bugs (#180558) next »