Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.2

Request #14448 Polluted error messages
Submitted: 2008-08-03 20:54 UTC
From: heino Assigned: chagenbu
Status: Closed Package: Net_Socket (version 1.0.9)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2008-08-03 20:54 UTC] heino (Heino H. Gehlsen)
Description: ------------ The new feature "Catch errors from fsockopen() that happen before the socket is actually opened" pollutes error messages, which is already returned by fsockopen(). That's not the intended purpose of this addition, is it ? --- Socket.php.orig 2008-08-03 22:45:27.000000000 +0200 +++ Socket.php.new 2008-08-03 22:47:59.000000000 +0200 @@ -149,7 +149,7 @@ } if (!$fp) { - if ($errno == 0 && isset($php_errormsg)) { + if ($errno == 0 && empty($errstr) && isset($php_errormsg)) { $errstr = $php_errormsg; } @ini_set('track_errors', $old_track_errors); Test script: --------------- include_once('Net/Socket.php'); $socket = new Net_Socket(); if (PEAR::isError($err = $socket->connect('nonexistent.example.com'))) { echo "[{$err->getCode()}] {$err->getMessage()}\r\n\r\n"; } if (PEAR::isError($err = $socket->connect('nonexistent.example.com', 119))) { echo "[{$err->getCode()}] {$err->getMessage()}\r\n\r\n"; } Expected result: ---------------- [0] Failed to parse address "nonexistent.example.com" [0] php_network_getaddresses: getaddrinfo failed: Name or service not known Actual result: -------------- [0] fsockopen(): unable to connect to nonexistent.example.com:0 (Failed to parse address "nonexistent.example.com") [0] fsockopen(): unable to connect to nonexistent.example.com:119 (php_network_getaddresses: getaddrinfo failed: Name or service not known)

Comments

 [2008-12-01 15:20 UTC] chagenbu (Chuck Hagenbuch)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.