ID: 32469 Updated by: [EMAIL PROTECTED] Reported By: mccaskey at stanford dot edu Status: Closed Bug Type: Filesystem function related Operating System: Windows XP PHP Version: 5CVS-2005-03-29 New Comment:
sniper: are you sure this is fixed? Previous Comments: ------------------------------------------------------------------------ [2005-05-23 14:59:15] [EMAIL PROTECTED] This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2005-04-02 20:29:45] mccaskey at stanford dot edu (2) was an artifact of my test setup. Ignore that. But (1) stands: I can't see any input until 8K bytes have been read. Using a COM-port monitoring program, I can see and count the bytes coming in, and a terminal emulator gets them starting with the first byte, but php (fread, fgets, or fgetc) doesn't. ------------------------------------------------------------------------ [2005-03-29 08:03:58] mccaskey at stanford dot edu Tried it. No difference. ------------------------------------------------------------------------ [2005-03-29 00:40:59] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip ------------------------------------------------------------------------ [2005-03-28 03:56:10] mccaskey at stanford dot edu Description: ------------ (1) Open a COM port as a serial input using fopen. Read using fread or fgets. No data appears until 8K bytes have been read. There is an 8K buffer on writes, but there shouldn't be one on reads. (Should there?) Are reads somehow using the write buffer? Sure enough: (2) Again, open a COM port as a serial input using fopen. This time, write some characters using fwrite. Now fread 8K of serial data. At the head of that stream appears the data you had written with fwrite. Oops. [Several people have reported an inability to get fgets to read COM data, saying they tried and fgets just never sees any input. I assume this was their problem. But others have reported using fgets on COM successfully. Something specific to OS/PHP versions?] Reproduce code: --------------- (1) $serial_port = fopen("COM4", "r+"); echo(fread($serial_port, 8192)); (2) $serial_port = fopen("COM4", "r+"); fwrite($serial_port, "MP"); echo(fread($serial_port, 8192)); Expected result: ---------------- (1) & (2) serial data starting with the first byte that came in on the serial line Actual result: -------------- (1) Nothing until 8K of data has been read in. (2) After enough serial data to fill the buffer, first the data written ("MP" in this example), then the data that came in on the serial line. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=32469&edit=1