Git-Host / php-fetion

Automatically exported from code.google.com/p/php-fetion
0 stars 0 forks source link

_postWithCookie方法的bug #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
fget的死循环问题
参见官方文档:http://php.net/manual/en/function.feof.php
"
Warning
If the passed file pointer is not valid you may get an infinite loop, because 
feof() fails to return TRUE.
"

可改成:
        while (!feof($fp))
        {
            $re = fgets($fp);
            if (false === $re) {
                break;
            }
            $result .= $re;
        }

Original issue reported on code.google.com by lingyey...@gmail.com on 28 Sep 2014 at 9:07