|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16886 Seg. fault on socket_close if socket died
Submitted: 2002-04-28 08:43 UTC Modified: 2002-09-11 11:00 UTC
From: tech at kalyweb dot com Assigned:
Status: Not a bug Package: Sockets related
PHP Version: 4.0CVS-2002-04-28 OS: Linux RedHat 7.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: tech at kalyweb dot com
New email:
PHP Version: OS:


 [2002-04-28 08:43 UTC] tech at kalyweb dot com
I had that issue :
I use a non blocking socket to read a data stream.

I was assuming that if socket_read($socket) !== false then I should close the socket !!
NO ! I must not !
If I close that socket, I have an error : 9975 Segmentation fault      /usr/local/php-cgi/bin/php -q ./core.php

I checked socket_last_error and I found : 104 : Connexion reset by peer ....

It would be nice if the socket is checked before socket_close or socket_shutdown ...

I don't know sockets system under Linux . I can't fix that :(

To have the same error, create a socket, listen on it, accept accept that connexion. On the remote machine, close the telnet (kill or other :D) and then do socket_close on your socket.
Then you have a seg. fault !


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-28 08:57 UTC]
To properly diagnose this bug, we need a backtrace to see what is
happening behind the scenes. To find out how to generate a backtrace,
please read

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open".
 [2002-09-11 11:00 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Jul 01 18:05:45 2022 UTC