ID: 49084
User updated by: morrisdavidd at gmail dot com
Reported By: morrisdavidd at gmail dot com
Status: Bogus
Bug Type: Streams related
Operating System: Linux/Unix
PHP Version: 5.3.0
New Comment:
My code was not intended to be "real world", it was intended to accent
a bug. However, here's a slightly rewritten bug demonstration:
http://capricorn.physics.fsu.edu/~ddm05/bug_demo2.txt
With non-blocking I/O, I expect to see ~4 "Loop!" statements for each
timestamp, since "Loop!" echos every .5 sec and the timestamp echos
every 2 seconds.
P.S. The output should be the same as when the filter is removed.
Previous Comments:
------------------------------------------------------------------------
[2009-07-31 16:57:43] jani@php.net
Well, your test is inherently buggy. You never return PSFS_PASS_ON from
the filter to begin with. And yes, to get this really working you HAVE
to use fread().
------------------------------------------------------------------------
[2009-07-30 02:42:09] morrisdavidd at gmail dot com
Yes, that is what I expect to see.
To restate:
I do not expect to see an infinite number of "x"es on any non-block
read like you see in "bug_demo". I expect the non-block read to return
immediately resulting in another "Loop!" statement. i.e. I expect the
output of "bug_demo" with the "badFilter" to be the same as with the
"goodFilter" and the number of "x"es to be similar to the number of
"Loop!"s.)
------------------------------------------------------------------------
[2009-07-29 23:15:16] jani@php.net
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?
------------------------------------------------------------------------
[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()..
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/49084--
Edit this bug report at http://bugs.php.net/?id=49084&edit=1