php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #26024 Add function handler for set_time_limit()
Submitted: 2003-10-28 18:45 UTC Modified: 2010-11-24 09:04 UTC
From: seventhcycle at yahoo dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.3 OS: linux
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: seventhcycle at yahoo dot com
New email:
PHP Version: OS:

 

 [2003-10-28 18:45 UTC] seventhcycle at yahoo dot com
Description:
------------
It would be nice to have an optional function handler for when set_time_limit() goes over the set amount of time.

Reproduce code:
---------------
<?

   set_time_limit(30, "errfunc");
   while(1) { $g=1; }

   function errfunc()
   {
      echo "Hey, this is taking too long!";
      exit;
   }
?>

Expected result:
----------------
After 30 seconds, errfunc() is called, and the program executes gracefully, without an error message and a line number.

This would be useful, say, if doing a merchant transaction with a separate server and it's stalling on giving a response.

Actual result:
--------------
Hey, this is taking too long

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-24 09:04 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-11-24 09:04 UTC] jani@php.net
Use register_shutdown_function() together with connection_status(). See also: 

  http://www.php.net/manual/en/features.connection-handling.php
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 10:01:30 2025 UTC