Warnings from http.php: supplied argument is not a valid stream resource…
-
If fsockopen function is disabled on your server, you may get endless warnings messages when you open plugins page. Warning message comes from wp-includes/http.php file line 520 and below:
Warning: stream_set_timeout(): supplied argument is not a valid stream resource in /var/www/…URL…/wp-includes/http.php at line 520
Warning: fwrite(): supplied argument is not a valid stream resource in /var/www/…URL/wp-includes/http.php at line 544
As far as I understand, this is because fsockopen at line 505 (http.php) fails, but go unnoticed through the control at line 515.
if ( false === $handle )
This is probably because $handle returned by fsockopen is empty.Replacing
if ( false === $handle )
with
if ( !$handle )
prevented the warning messages.My question is, isn’t it possible to use any alternative methods for HTTP connections? Comments says there are 4 alternative methods for HTTP connections and fsockopen is the last one to be used (http.php line 67-82).
Some facts that may be useful:
- After removing the @ sign at line 505 where fsockopen() called, I got this msg:
Warning: fsockopen() has been disabled for security reasons in… - WP_Http_Fsockopen::test() passes, since function_exists(fsockopen) returns true!
(From the PHP manual for function_exists:
<i>Note: A function name may exist even if the function itself is unusable due to configuration or compiling options (with the image functions being an example).</i>) - Above the line I got those warnings the comment says :
//Removed sanity checking for performance reasons.
(:
- After removing the @ sign at line 505 where fsockopen() called, I got this msg:
- The topic ‘Warnings from http.php: supplied argument is not a valid stream resource…’ is closed to new replies.