php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8413 connection_status() returns 0 on timeout
Submitted: 2000-12-25 05:41 UTC Modified: 2001-07-09 08:22 UTC
From: omakarenko at cyberplat dot ru Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.4 OS: linux
Private report: No CVE-ID: None
 [2000-12-25 05:41 UTC] omakarenko at cyberplat dot ru
safe_mode is off.

timeout.php:
<?php

register_shutdown_function("shutdown");
set_time_out(1);
while(1);

function shutdown() {
   printf ("Shutdown: %d\n", connection_status());
   if (connection_timeout()) {
      print ("Connection timeout\n");
   }
}

?>

php timeout.php gives me Shutdown: 0 instead of 2 and "Connection timeout"

That is true for php since 4.0.1

The PHP_CONNECTION_TIMEOUT flag is never turned on in zend_execute_API.c

oleg

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-25 07:02 UTC] omakarenko at cyberplat dot ru
I am not sure what "bug type" to choose...

So I change it to "Unknown/Other" for now.

oleg
 [2001-01-13 13:33 UTC] cynic@php.net
I get no output at all (RH6.2 4.0.4 & NT5 php4-200101130745)
 [2001-01-15 08:55 UTC] omakarenko at cyberplat dot ru
use standalone php to get the output or change the code somehow to get the result of connection_status() and connection_timeout() some other way (write to file, for example)

the point is that it seems to be impossible to check for timeout state: connection_status() and connection_timeout() both return zero while the shutdown function was definitly called due to timeout.

The example is stupid but it is short and clearly demonstartes the bug.

oleg
 [2001-06-14 16:44 UTC] sniper@php.net
This is obvious. The time the shutdown function
is called, the status IS shutdown.

And the connection_timeout() function is deprecated (and
removed) as of 4.0.5


 [2001-06-15 02:53 UTC] omakarenko at cyberplat dot ru
> This is obvious. The time the shutdown function
> is called, the status IS shutdown.

AND the status IS timeout. That is obvious too :)

It is a bit flag and it could also indicate that the connection was timeouted if only some php developer was not so lazy :)))

> And the connection_timeout() function is deprecated (and
> removed) as of 4.0.5

that is nice. The report was for 4.0.4 and the connection_timeout() was used only to make the code shorter. Change it to connection_status() and reopen the bug.

How can I determine that the script was terminated due to execution_time limit? connection_status() is not depricated yet, is it? But it still doesn't return the TIMEOUT status.

Just grep through the code... PHP_CONNECTION_TIMEOUT is defined but never used. Is it also depricated?

=oleg

 [2001-07-09 08:22 UTC] jeroen@php.net
closing

We should really nuke phpdoc/features/connection_handling,
or rewrite it...
 [2001-07-09 08:22 UTC] jeroen@php.net
closing

We should really nuke phpdoc/features/connection_handling,
or rewrite it...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC