#22057 [Bgs->Opn]: fgets function failure
| From: | elazizli at celiknet dot com | Date: | Tue, 04 Feb 2003 21:59:23 +0000 |
| Subject: | #22057 [Bgs->Opn]: fgets function failure | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-32122@lists.php.net to get a copy of this message | ||
ID: 22057
User updated by: elazizli@celiknet.com
Reported By: elazizli@celiknet.com
-Status: Bogus
+Status: Open
Bug Type: Filesystem function related
PHP Version: 4.3.0
New Comment:
PHP manual doesn't tell why this function start to give an error in
version 4.3 while working fine with 4.2.x.
I also tried less efficient ways of getting http headers just for test
purposes and such 3-character long string never appears. That
inefficient method returns same string fgets in 4.2.3 used to return.
PHP manual says the function was modified regarding a fix about
binaries. does that affect the result?
As I say it is not about HTTP or server settings. Same code is not
working with 4.3 although it worked fine with 4.2.3.
Sorry but your answer doesn't help to explain why this error happened
after upgrading to 4.3 while keeping all server and configuration
settings same.
Previous Comments:
------------------------------------------------------------------------
[2003-02-04 15:39:24] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
fgets() will only return a single line of data or the requested number
of bytes, which ever one is smallest will be returned. In case of HTTP,
the 1st line that will be sent to you by the webserver will be the
response code, which in many cases is just a number 3 bytes long.
------------------------------------------------------------------------
[2003-02-04 15:29:19] elazizli@celiknet.com
The following code used to return correct headers for the requested
page whit PHP 4.2.3.. $host, $port and $path variables are dynamically
assigned by the script.
Now it doesn't work without any configuration change other than PHP
upgrade. It returns a three-character string instead of the requested
information. Is this because of the change applied to fgets function in
PHP 4.3? Same code stopped working when migrated to 4.3 from 4.2.3, no
module or configuration change happened during upgrade, same settings
were kept.
$fp = fsockopen($host,$port);
$request =
"GET $path HTTP/1.1
Host: $host$port
Accept: */*
Accept-Charset: iso-8859-1
Accept-Encoding: identity
";
fputs($fp,$request);
$answer = fgets($fp,4096);
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22057&edit=1