From:             tleaver at synchronics dot com
Operating system: Windows XP
PHP version:      4.3.4
PHP Bug Type:     Sockets related
Bug description:  fread bug reading large block of data from a socket

Description:
------------
We have a commercial PHP-based product, basically a web app which
interfaces with our Counterpoint point of sale product, and is designed to
run on wireless handheld devices.



Communications with Counterpoint is handled via an application server,
which we communicate with from PHP via a socket connection.



Of the different types of messages we pass back and forth between PHP and
the application server, is a transaction describing a complex item with
multiple dimensions (size, color, etc).  When retreiving this large block
of data from the socket using fread, we get unexpected data.



Each packet which is exchanged consists of a beginning 1 byte marker
("\x02") which denotes the beginning of a package, followed by a protocol
version (internal designator), followed by 2 bytes indicating the length
of the packet.  We then fread that number of bytes from the socket,
followed by 12 bytes of additional data tacked onto the end of the
information.



Certain communications are multi-packet, so the code loops until we either
hit an feof condition or do not receive the expected beginning marker
(which is an error).



Using PHP 4.3.1 and earlier, down to 4.1.1, the code works fine.  With PHP
4.3.2 and newer, including 4.3.5RC3, the code chokes on large packets.



That's as precise as I've been able to be to date.  We are not using a
debug tool as of yet, so I can't be very precise.  The code necessary to
reproduce the problem would require Counterpoint and our application
server be installed, which isn't feasible.



Perhaps someone could look for changes in fread since 4.3.1 and see if
there is a problem?


-- 
Edit bug report at http://bugs.php.net/?id=27466&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27466&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27466&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27466&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27466&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27466&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27466&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27466&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27466&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27466&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27466&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27466&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27466&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27466&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27466&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27466&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27466&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27466&r=float

Reply via email to