php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63172 Script hangs after max_execution_time (tzset)
Submitted: 2012-09-27 14:30 UTC Modified: 2018-01-13 11:41 UTC
From: remi@php.net Assigned: nikic (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: 5.4.7 OS: GNU/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: remi@php.net
New email:
PHP Version: OS:

 

 [2012-09-27 14:30 UTC] remi@php.net
Description:
------------
As tzset functions is not async-signal-safe, nor safe to be longjmp'ed out, If a timeout occurs during soem glib call, with a lock set, the PHP script will hangs.


tzset should not be called during timeout management.


Attached patch solves this.

Test script:
---------------
<?php
ini_set('max_execution_time', '1');
echo "Playing with env. and tzset";
$tabs = timezone_identifiers_list();

while (true) {
	foreach ($tabs as $tab) {
		putenv("TZ=$tab");
	}
	echo ".";
}


Must be run various time to reproduce


Expected result:
----------------
Script output "PHP Fatal error:  Maximum execution time of 1 second exceeded in..." and exit.


Actual result:
--------------
Script hangs after "PHP Fatal error:  Maximum execution time of 1 second exceeded in..."

Patches

tzset.patch (last revision 2012-09-27 14:30 UTC by remi)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-31 02:52 UTC] yohgaki@php.net
It seems this is fixed in 5.5, but not in 5.4.
 [2018-01-13 11:41 UTC] nikic@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nikic
 [2018-01-13 11:41 UTC] nikic@php.net
If this hasn't been fixed by something else already, this problem should definitely be resolved in PHP 7.1, as PHP will no longer interrupt internal function calls on timeout.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC