ID: 23220 Comment by: chris dot edwards at obinet dot com Reported By: storozhilov at mail dot ru Status: Assigned Bug Type: Filesystem function related Operating System: FreeBSD 4.8 PHP Version: 4-STABLE-200307070330 Assigned To: wez New Comment:
Getting the exact same error. Same OS, same version of PHP. Changing the length of the string offered no changes. I still get: SSL: fatal protocol error I'm getting this for fread() and fgets(). Previous Comments: ------------------------------------------------------------------------ [2003-08-21 20:25:22] info at splendense dot nl Using '$buff = fgets ($f, 355);' does not give any error, however 356 does for me (php 4.3.2 solaris). My script seems to work fine but maybe a response string greater than 355 chars will not work?!? ------------------------------------------------------------------------ [2003-08-21 20:18:33] scottm at spamcop dot net I've not verified this patch will work and I'll hopefully test it tomorrow. I believe it is reaching the end of the file and nr_bytes is returning 0 and this is being caught by an if statement which should be looking for -1. --- network.c Thu Aug 21 21:06:43 2003 +++ network.c.patched Thu Aug 21 21:13:09 2003 @@ -1011,13 +1011,14 @@ do { nr_bytes = SSL_read(sock->ssl_handle, buf, count); - if (nr_bytes <= 0) { + if (nr_bytes < 0) { retry = handle_ssl_error(stream, nr_bytes TSRMLS_CC); if (retry == 0 && !SSL_pending(sock->ssl_handle)) { stream->eof = 1; } } else { - /* we got the data */ + /* we got the data */ + stream->eof = 1; break; } } while (retry); ------------------------------------------------------------------------ [2003-08-05 09:43:36] uk at access dot lv php4.3.2 configured with-openssl if ($f = fopen('https://site', 'r')) { while (!feof($f)) { $buff = fgets ($f, 1024); echo $buff; } } fclose ($f); Warning: fgets(): SSL: fatal protocol error if i read just some bits then no error. ------------------------------------------------------------------------ [2003-07-07 00:48:32] severitt at ihug dot co dot nz After experiencing this same bug with php 4.3.2 on FreeBSD 4.4, I came searched here and found this bug report. After reading the comment to try the latest stable version, I compiled and installed php4-STABLE-200307070330. However the problem still remains. It appears that maybe feof() is not detecting the eof properly, because if I read in less bytes than the the size of the response, I don't get this warning. ------------------------------------------------------------------------ [2003-04-15 01:52:09] storozhilov at mail dot ru <?php $fd = fsockopen( 'ssl://www.somehost.com', 443, $errno, $errstr, 30 ); fputs($fd, "GET / HTTP/1.0\r\n\r\n"); while (!feof($fd)) { echo fgets($fd, 1024); ); ?> After executing of this script following message appears: Warning: fgets() [function.fgets]: SSL: fatal protocol error in /blah/blah/blah/blah.php on line NN PHP was configured with following arguments: #!/bin/sh ./configure --with-apache=../apache_1.3.27rusPL30.17 --with-mod_charset --with-pgsql=/usr/local/pgsql --with-mhash --with-sybase=/usr/local --with-openssl ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=23220&edit=1