#49084 [Opn->Fbk]: PSFS_FEED_ME causes stream block
| From: | jani@php.net | Date: | Wed, 29 Jul 2009 23:15:17 +0000 |
| Subject: | #49084 [Opn->Fbk]: PSFS_FEED_ME causes stream block | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-140457@lists.php.net to get a copy of this message | ||
ID: 49084
Updated by: jani@php.net
Reported By: morrisdavidd at gmail dot com
-Status: Open
+Status: Feedback
Bug Type: Streams related
Operating System: Linux/Unix
PHP Version: 5.3.0
New Comment:
We must have different idea of "working" or this is what you expect:
$ sapi/cli/php -n working_demo.txt
bool(true)
Loop!
xLoop!
x
Now, what should this output?
Previous Comments:
------------------------------------------------------------------------
[2009-07-29 19:00:30] morrisdavidd at gmail dot com
See:
http://capricorn.physics.fsu.edu/~ddm05/working_demo.txt
Or were you asking for something else?
The whole fgets vs fread thing shouldn't matter for this bug, I've came
across plenty of "you should use fgets instead of fread when not
blocking" statements before I submitted this code. So I did test fread
which had no changes with respect to the bug except more overhead to
extract separate lines.)
------------------------------------------------------------------------
[2009-07-29 13:50:54] jani@php.net
Can you please provide reproducing scripts that actually give the
expected output with the "goodFilter" ?? And fyi, with non-blocking you
should use fread() instead of fgets()..
------------------------------------------------------------------------
[2009-07-28 06:08:58] morrisdavidd at gmail dot com
Actual result is when leaving "badFilter".)
------------------------------------------------------------------------
[2009-07-28 06:07:22] morrisdavidd at gmail dot com
Description:
------------
According to:
http://us3.php.net/manual/en/function.stream-filter-register.php
The return value of PSFS_FEED_ME for the method filter of extended
classes of php_user_filter means: "Filter processed successfully,
however no data was available to return. More data is required from the
stream or prior filter."
However, using the return value of PSFS_FEED_ME also inadvertently
causes a block on stream read requests that should not be blocked (and
an infinite poll for data?).
Reproduce code:
---------------
bug_demo.php:
http://capricorn.physics.fsu.edu/~ddm05/bug_demo.txt
test2.php:
http://capricorn.physics.fsu.edu/~ddm05/test2.txt
Expected result:
----------------
When replacing the phrase "badFilter" with "goodFilter" in line 44:
bool(true)
Loop!
xLoop!
xxtest2: 1248760722
Loop!
xLoop!
xLoop!
xLoop!
xxtest2: 1248760724
Loop!
xLoop!
xLoop!
xLoop!
xxtest2: 1248760726
Loop!
...
Actual result:
--------------
bool(true)
Loop!
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49084&edit=1