Hi, while pondering around with #17185 I came about this little issue here (trying to readfile an url which doesn't exist):
Given: <? error_reporting(E_ALL); $foo = readfile("http://guru.josefine.at/messanottaexist"); var_dump($foo); ?> HEAD compiled with debug: Warning: HTTP request failed! HTTP/1.1 404 Not Found in readfile.php on line 4 readfile.php(4) : Warning - HTTP request failed! HTTP/1.1 404 Not Found Warning: readfile("http://guru.josefine.at/woho") - Success in readfile.php on line 4 readfile.php(4) : Warning - readfile("http://guru.josefine.at/woho") - Success bool(false) /home/mfischer/isrc/cvs/php4/Zend/zend_hash.c(406) : Freeing 0x082269A4 (35 bytes), script=- Last leak repeated 4 times /home/mfischer/isrc/cvs/php4/ext/standard/http_fopen_wrapper.c(268) : Freeing 0x08226944 (44 bytes), script=- Last leak repeated 3 times /home/mfischer/isrc/cvs/php4/ext/standard/http_fopen_wrapper.c(266) : Freeing 0x08226904 (12 bytes), script=- Last leak repeated 3 times /home/mfischer/isrc/cvs/php4/ext/standard/http_fopen_wrapper.c(212) : Freeing 0x082261E4 (25 bytes), script=- /home/mfischer/isrc/cvs/php4/Zend/zend_hash.c(178) : Freeing 0x0822885C (32 bytes), script=- /home/mfischer/isrc/cvs/php4/ext/standard/http_fopen_wrapper.c(186) : Freeing 0x08228554 (44 bytes), script=- /home/mfischer/isrc/cvs/php4/Zend/zend_API.c(565) : Actual location (location was relayed) /home/mfischer/isrc/cvs/php4/ext/standard/http_fopen_wrapper.c(185) : Freeing 0x0822915C (12 bytes), script=- /home/mfischer/isrc/cvs/php4/ext/standard/http_fopen_wrapper.c(195) : Freeing 0x0822892C (12 bytes), script=- Two things puzzling me here: 1) The phrase success; Warning: readfile("http://guru.josefine.at/woho") - Success in readfile.php on line 4 2) The memory leaks obviously :-) No idea what's wrong with 2) but regarding to 1) I've a few remarks. In php4/main/streams.c around 1340 we have: if (stream == NULL && (options & REPORT_ERRORS)) { char *tmp = estrdup(path); char *msg; if (wrapper) msg = strerror(errno); // MARK 1 else msg = "no suitable wrapper could be found"; php_strip_url_passwd(tmp); zend_error(E_WARNING, "%s(\"%s\") - %s", get_active_function_name(TSRMLS_C), tmp, msg); efree(tmp); } return stream; The line I've marked with 'MARK 1' results in the 'Success' phrase because errno is just zero. And as far as I could see in php4/ext/standard/http_fopen_wrapper.c errrno is never set to any kind of error value. It doesn't nmake much sense anyway because it's an HTTP error, nothing which is covered with any of the system error messages. I think we should seek for another solution here (stream-dependant error handling?) Also the error output looks confusing, becuse the bug is reported twice: Warning: HTTP request failed! HTTP/1.1 404 Not Found in readfile.php on line 4 readfile.php(4) : Warning - HTTP request failed! HTTP/1.1 404 Not Found and then Warning: readfile("http://guru.josefine.at/woho") - Success in readfile.php on line 4 readfile.php(4) : Warning - readfile("http://guru.josefine.at/woho") - Success The former one is generated by php_stream_url_wrap_http itself, the latter by _php_stream_open_wrapper_ex. Despite this, awesome work Wez did here! regards, - Markus -- Please always Cc to me when replying to me on the lists. GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc --------------------------------------------------------- "I mean "When in doubt, blame mcrypt" is more often right than wrong :)" "Always right, never wrong :)" - Two PHP developers who want to remain unnamed -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php