From:             [EMAIL PROTECTED]
Operating system: Linux
PHP version:      4.3.0
PHP Bug Type:     Sockets related
Bug description:  socket_read does not stop at line breaks

I followed the instructions on all the manuals and tried searching the
inet, but couldent find anything that solved this.

I have a socket that is supposed to read from a client (this is a smtpd
server-type script)..

When I use 

while ($line = socket_read($my_socket,2048,PHP_NORMAL_READ)) {

stuff
}

I can connect to this server via win32 putty, and it will break on line
breaks. But when using Linux telnet and trying to get other smtpd's to
send to it, they would have to send 2048 bytes to get stuff to execute
once.

To make sure they were sending \r or \n I made the socket read go byte by
byte and assemble a string, checking for \n or \r

 while($tstr = socket_read($connection,1)) {

                         if (($tstr != chr(13)) && ($tstr != chr(10))) {
                                 $buf .= $tstr;
                                  continue;
                         }

^^Example of my byte-by-byte checker

It does find \r and \n in the strings and I am able to gte my server to
work...

Would be nice if the built in function socket_read would really break on
\n or \r.

If more information is needed, please ask....
-- 
Edit bug report at http://bugs.php.net/?id=21880&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21880&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21880&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21880&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21880&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21880&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21880&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21880&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21880&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21880&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21880&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21880&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21880&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21880&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21880&r=gnused

Reply via email to