php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8994 socket_set_timeout works only once
Submitted: 2001-01-30 05:36 UTC Modified: 2001-04-26 09:56 UTC
From: tom dot anheyer at berlinonline dot de Assigned:
Status: Closed Package: Network related
PHP Version: 4.0.4pl1 OS: Any
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tom dot anheyer at berlinonline dot de
New email:
PHP Version: OS:

 

 [2001-01-30 05:36 UTC] tom dot anheyer at berlinonline dot de
socket_set_timeout() works only once. 
This is because the internal function php_sock_fgets() checks the timout flag before calling php_sockread_internal(). If blocking IO  php_sockwait_for_data() is called next. This function resets the socket timeout flag.

A possible solution is to reset the flag in php_sockset_timeout() like the following patch. Removing the timeout flag test from php_sock_fgets() is also possible maybe.

diff -c /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c-orig /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c
*** /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c-orig	Tue Jan 30 11:19:59 2001
--- /usr/src/packages/BUILD/php-4.0.4pl1/ext/standard/fsock.c	Tue Jan 30 11:19:59 2001
***************
*** 596,601 ****
--- 596,602 ----
  	SOCK_FIND(sock, socket);
  
  	sock->timeout = *timeout;
+ 	sock->timeout_event = 0;
  }
  
  #define SOCK_FIND_AND_READ_MAX(max) \

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-22 04:11 UTC] tom dot anheyer at berlinonline dot de
please fix this issue for the final 4.0.5. It is not fixed 
in 4.0.5RC1. I think it's easy to fix.

 [2001-03-22 04:11 UTC] tom dot anheyer at berlinonline dot de
please fix this issue for the final 4.0.5. It is not fixed 
in 4.0.5RC1. I think it's easy to fix.

 [2001-04-26 09:49 UTC] sterling@php.net
Applied in CVS, don't know if it will make 4.0.5 this late
in the game.  Thanks!
 [2001-04-26 09:56 UTC] sterling@php.net
Applied in CVS, don't know if it will make 4.0.5 this late
in the game.  Thanks!
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 16:01:31 2025 UTC