php-src/tests/basic
Alex Dowad 555489dd83 Honor script time limit when calling shutdown functions
A time limit can be set on PHP script execution via `set_time_limit` (or .ini file).
When the time limit is reached, the OS will notify PHP and `timed_out` and `vm_interrupt`
flags are set. While these flags are regularly checked when executing PHP code, once the
end of the script is reached, they are not checked while invoking shutdown functions
(registered via `register_shutdown_function`).

Of course, if the shutdown functions are implemented *in* PHP, then the interrupt flag
will be checked while the VM is running PHP bytecode and the timeout will take effect.
But if the shutdown functions are built-in (implemented in C), it will not.

Since the shutdown functions are invoked through `zend_call_function`, add a check of the
`vm_interrupt` flag there. Then, the script time limit will be respected when *entering*
each shutdown function. The fact still remains that if a shutdown function is built-in and
runs for a long time, script execution will not time out until it finishes and the
interpreter tries to invoke the next one.

Still, the behavior of scripts with execution time limits will be more consistent after
this patch. To make the execution time-out feature work even more precisely, it would
be necessary to scrutinize all the built-in functions and add checks of the `vm_interrupt`
flag in any which can run for a long time. That might not be worth the effort, though.

It should be mentioned that this patch does not solely affect shutdown functions, neither
does it solely allow for interruption of running code due to script execution timeout.
Anything else which causes `vm_interrupt` to be set, such as the PHP interpreter receiving
a signal, will take effect when exiting from an internal function. And not just internal
functions which are called because they were registered to run at shutdown; there are
other cases where a series of internal functions might run in the midst of a script. In
all such cases, it will be possible to interrupt the interpreter now.

Closes GH-5543.
2020-05-13 12:47:12 +02:00
..
001.phpt
002.phpt
003.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
004.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
005.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
006.phpt
007.phpt
008.phpt
009.phpt
010.phpt
011.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
012.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
013.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
014.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:45:12 +02:00
015.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
016.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
017.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
018.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
019.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
020.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
021.phpt Fix bug 61716 tests\basic\021.phpt fails 2012-04-16 15:14:26 +02:00
022.phpt
023.phpt
025.phpt Improve undefined variable error messages 2020-03-31 13:02:32 +02:00
028.phpt
029.phpt Remove some uses of deprecated internal_encoding settings in tests 2019-04-17 14:24:11 +02:00
030.phpt
031.phpt
032.phpt
bug20539.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
bug29971.phpt Remove executable permission on phpt 2012-10-10 10:27:49 +08:00
bug31875.phpt Completely remove disabled functions from function table 2020-04-30 09:53:57 +02:00
bug45986.phpt Trim trailing whitespace in *.phpt 2018-10-14 19:46:15 +02:00
bug53180.phpt Fix CRLF line-endings in tests 2016-11-20 22:31:24 +01:00
bug54514.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
bug55500.phpt Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
bug61000.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
bug67198.phpt Switch to using shell-less proc_open() in various server tests 2019-07-11 15:48:10 +02:00
bug67988.phpt Fixed Bug #67988 htmlspecialchars() does not respect default_charset specified by ini_set. 2015-02-03 18:52:46 +09:00
bug71273.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
bug73969.inc Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called 2017-01-22 16:11:25 +00:00
bug73969.phpt Fixed #73969 - Fixed segmentation fault when debug_print_backtrace called 2017-01-22 16:11:25 +00:00
bug78929.phpt Fix #78929: plus signs in cookie values are converted to spaces 2019-12-12 14:21:46 +01:00
consistent_float_string_casts.phpt Make float to string casts locale-independent 2020-05-08 10:52:23 +02:00
enable_post_data_reading_01.phpt Improve undefined variable error messages 2020-03-31 13:02:32 +02:00
enable_post_data_reading_02.phpt tests 2013-09-10 13:14:02 +02:00
enable_post_data_reading_03.phpt Improve undefined variable error messages 2020-03-31 13:02:32 +02:00
enable_post_data_reading_04.phpt Improve undefined variable error messages 2020-03-31 13:02:32 +02:00
enable_post_data_reading_05.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
enable_post_data_reading_06.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
enable_post_data_reading_07.phpt Fix seeking in php://input 2019-01-18 12:44:47 +01:00
encoding.phpt Sync leading and final newlines in *.phpt sections 2018-10-15 04:31:31 +02:00
header_register_callback.phpt Fixed bug memleak in header_register_callback 2015-12-11 17:26:31 +08:00
precision.phpt Swap implode() argument order in some tests 2019-07-12 12:54:10 +02:00
req44164.phpt Fix CRLF line-endings in tests 2016-11-20 22:31:24 +01:00
req60524-win.phpt Change PHP_OS_FAMILY slightly 2017-02-22 12:31:06 +01:00
req60524.phpt Make more tests run on Windows 2019-05-27 10:51:53 +02:00
rfc1867_anonymous_upload.phpt remove support for string|unicode in tests 2018-02-22 08:11:30 +01:00
rfc1867_array_upload.phpt Remove more PHP 6 leftovers from tests 2016-11-24 22:39:39 +01:00
rfc1867_boundary_1.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
rfc1867_boundary_2.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
rfc1867_empty_upload.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
rfc1867_file_upload_disabled.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
rfc1867_garbled_mime_headers.phpt Decouple DEBUG_FILE_UPLOAD from ZEND_DEBUG 2016-08-19 00:34:13 +02:00
rfc1867_invalid_boundary.phpt Decouple DEBUG_FILE_UPLOAD from ZEND_DEBUG 2016-08-19 00:34:13 +02:00
rfc1867_malicious_input.phpt Use EXPECT instead of EXPECTF when possible 2018-02-20 21:53:48 +01:00
rfc1867_max_file_size.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
rfc1867_max_file_uploads_empty_files.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
rfc1867_missing_boundary_2.phpt Use EXPECT instead of EXPECTF when possible 2018-09-16 15:39:18 -03:00
rfc1867_missing_boundary.phpt Decouple DEBUG_FILE_UPLOAD from ZEND_DEBUG 2016-08-19 00:34:13 +02:00
rfc1867_post_max_filesize.phpt Reindent phpt files 2020-02-03 22:52:20 +01:00
rfc1867_post_max_size.phpt Decouple DEBUG_FILE_UPLOAD from ZEND_DEBUG 2016-08-19 00:34:13 +02:00
timeout_variation_0.phpt Fix timeout tests 2019-12-05 11:19:23 +01:00
timeout_variation_1.phpt Fix timeout tests 2019-12-05 11:19:23 +01:00
timeout_variation_2.phpt Fix timeout tests 2019-12-05 11:19:23 +01:00
timeout_variation_4.phpt Fix timeout tests 2019-12-05 11:19:23 +01:00
timeout_variation_7.phpt Fix timeout tests 2019-12-05 11:19:23 +01:00
timeout_variation_8.phpt Fix timeout tests 2019-12-05 11:19:23 +01:00
timeout_variation_9.phpt Honor script time limit when calling shutdown functions 2020-05-13 12:47:12 +02:00
timeout_variation_10.phpt Honor script time limit when calling shutdown functions 2020-05-13 12:47:12 +02:00