From: rpiccini at software4u dot it Operating system: WIN XP / UBUNTU 9.04 PHP version: 5.2.11 PHP Bug Type: Filesystem function related Bug description: Can't read anything from serial port
Description: ------------ Either on WIN XP or UBUNTU 9.0 can't read back any data from serial port after correctly written to. I'm trying to talk to a fiscal printer trough a custom protocol based on ACK/NACK technique (send data -> receive answer -> respond to answer -> ...) With a serial port scanner (and from the ticket that are correctly printed) I can see that the sent data are well received from fiscal printer. But any "replay" to sent data (which are present if data are sent to serial port from other kind of software/programming languages) are present. The PHP Version is 5.2.11. There were a similar bug report on http://bugs.php.net/bug.php?id=35531 but its state is "closed" (even if the case history is very similar and the problem persists). Reproduce code: --------------- <?php // on UBUNTU $fp = fopen('/dev/ttyS0','r+'); // on WIN XP /*fp = fopen('COM1:','r+');*/ stream_set_timeout($fp, 0, 100); stream_set_blocking($fp,0); $stx = chr(2); $etx = chr(3); $string = $stx."030301346".$etx; // command to eject paper fputs($fp,$string); echo "SENT: ".$string."<br />\n"; // display string sent to serial port $buffer = fread($fp,128); // tested with several int values echo "RECEIVED: ".$buffer."<br />\n"; // display NOTHING! fclose($fp); ?> Expected result: ---------------- a correct ACK (chr(6)) or an incorrect NACK (chr(15)) from serial port (sent by the fiscal printer) Actual result: -------------- NOTHING (no a single char) -- Edit bug report at http://bugs.php.net/?id=49976&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49976&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49976&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49976&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49976&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49976&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49976&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49976&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49976&r=needscript Try newer version: http://bugs.php.net/fix.php?id=49976&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49976&r=support Expected behavior: http://bugs.php.net/fix.php?id=49976&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49976&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49976&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49976&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49976&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=49976&r=dst IIS Stability: http://bugs.php.net/fix.php?id=49976&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49976&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49976&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49976&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49976&r=mysqlcfg