php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6914 persistent socket connection failure
Submitted: 2000-09-27 22:17 UTC Modified: 2001-12-15 08:29 UTC
From: wbrack at mmm dot com dot hk Assigned:
Status: Closed Package: Sockets related
PHP Version: 4.0.2 OS: Linux 2.2.17
Private report: No CVE-ID: None
 [2000-09-27 22:17 UTC] wbrack at mmm dot com dot hk
A UNIX socket connection is made using pfsockopen().  On the initial script entry, a message is sent to our server and the reply is correctly received by the script.  On subsequent script entries, messages to the server are still sent successfully, but upon attempting to reply a SIGPIPE is received by server, and the php script receives a 0-length reply to its fgets() read.

We traced the problem to ext/standard/file.c, in the routine _file_socket_dtor().  In that routine, the macro SOCK_FCLOSE is used, which calls php_sock_close() in fsock.c.  This routine correctly handles the persistent socket.  However, after that call, _file_socket_dtor() then incorrectly calls the C routine shutdown(), which is what caused the problem.  In fact, php_sock_close() already completely takes care of the shutdown() (for the non-persistent case), so in any event the shutdown() call in _file_socket_dtor() is not necessary.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-11-21 12:06 UTC] mfischer@php.net
pfsockopen() works for me with latest RC
Can you try with latest RC and see if it works

http://www.php.net/~zeev/php-4.1.0RC3.tar.gz

Feedback.

 [2001-12-15 08:29 UTC] sander@php.net
No feedback. Closing.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Jan 22 17:01:25 2020 UTC