From 3f39551256b2d727b730f17797ab68fedd2838ba Mon Sep 17 00:00:00 2001 From: NickSdot Date: Tue, 28 Jul 2026 20:29:54 +0700 Subject: [PATCH 1/3] Remove redundant filesystem test delays --- ext/standard/tests/file/001.phpt | 2 +- ext/standard/tests/file/lstat_stat_basic.phpt | 2 -- ext/standard/tests/file/lstat_stat_variation10.phpt | 2 +- ext/standard/tests/file/lstat_stat_variation11.phpt | 2 +- ext/standard/tests/file/lstat_stat_variation13.phpt | 2 +- ext/standard/tests/file/lstat_stat_variation15.phpt | 1 - ext/standard/tests/file/lstat_stat_variation4.phpt | 2 +- 7 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ext/standard/tests/file/001.phpt b/ext/standard/tests/file/001.phpt index 8fe6946d72c2..01a07e19182c 100644 --- a/ext/standard/tests/file/001.phpt +++ b/ext/standard/tests/file/001.phpt @@ -24,7 +24,7 @@ if (file_exists('test.file')) { } else { echo "test.file does not exist\n"; } -sleep (2); +touch('test.file', 946684800); symlink('test.file','test.link'); if (file_exists('test.link')) { echo "test.link exists\n"; diff --git a/ext/standard/tests/file/lstat_stat_basic.phpt b/ext/standard/tests/file/lstat_stat_basic.phpt index 3d5e56b412ff..4cdd3d3051c7 100644 --- a/ext/standard/tests/file/lstat_stat_basic.phpt +++ b/ext/standard/tests/file/lstat_stat_basic.phpt @@ -31,7 +31,6 @@ $file_handle = fopen($filename, "w"); fclose($file_handle); // stat of the file created $file_stat = stat($filename); -sleep(2); // now new stat of the dir after file is created $new_dir_stat = stat($dirname); @@ -42,7 +41,6 @@ $sym_linkname = "$file_path/lstat_stat_basic_link.tmp"; symlink($filename, $sym_linkname); // stat of the link created $link_stat = lstat($sym_linkname); -sleep(2); // new stat of the file, after a softlink to this file is created $new_file_stat = stat($filename); clearstatcache(); diff --git a/ext/standard/tests/file/lstat_stat_variation10.phpt b/ext/standard/tests/file/lstat_stat_variation10.phpt index d4d142405da6..4a3a65e834d3 100644 --- a/ext/standard/tests/file/lstat_stat_variation10.phpt +++ b/ext/standard/tests/file/lstat_stat_variation10.phpt @@ -15,13 +15,13 @@ require "$file_path/file.inc"; /* create temp file, link and directory */ $dirname = "$file_path/lstat_stat_variation10"; mkdir($dirname); // temp dir +touch($dirname, 946684800); // is_dir() on a directory echo "*** Testing stat() on directory after using is_dir() on it ***\n"; $old_stat = stat($dirname); // clear the cache clearstatcache(); -sleep(1); var_dump( is_dir($dirname) ); $new_stat = stat($dirname); diff --git a/ext/standard/tests/file/lstat_stat_variation11.phpt b/ext/standard/tests/file/lstat_stat_variation11.phpt index 91510209a6f5..cde2a226fd8d 100644 --- a/ext/standard/tests/file/lstat_stat_variation11.phpt +++ b/ext/standard/tests/file/lstat_stat_variation11.phpt @@ -15,13 +15,13 @@ require "$file_path/file.inc"; $filename = "$file_path/lstat_stat_variation11.tmp"; $fp = fopen($filename, "w"); // temp file fclose($fp); +touch($filename, 946684800); // is_file() on a file echo "*** Testing stat() on a file after using is_file() on it ***\n"; $old_stat = stat($filename); // clear the stat clearstatcache(); -sleep(1); var_dump( is_file($filename) ); $new_stat = stat($filename); // compare self stats diff --git a/ext/standard/tests/file/lstat_stat_variation13.phpt b/ext/standard/tests/file/lstat_stat_variation13.phpt index 45f7a17c570f..a69a9441ed54 100644 --- a/ext/standard/tests/file/lstat_stat_variation13.phpt +++ b/ext/standard/tests/file/lstat_stat_variation13.phpt @@ -17,10 +17,10 @@ $filename = "$file_path/lstat_stat_variation13.tmp"; echo "*** Checking stat() on a file opened using read/write mode ***\n"; $file_handle = fopen($filename, "w"); // create file fclose($file_handle); +touch($filename, 946684800); $old_stat = stat($filename); // clear the stat clearstatcache(); -sleep(1); // opening file again in read mode $file_handle = fopen($filename, "r"); // read file fclose($file_handle); diff --git a/ext/standard/tests/file/lstat_stat_variation15.phpt b/ext/standard/tests/file/lstat_stat_variation15.phpt index 2d1157d401b5..99c567767d99 100644 --- a/ext/standard/tests/file/lstat_stat_variation15.phpt +++ b/ext/standard/tests/file/lstat_stat_variation15.phpt @@ -31,7 +31,6 @@ $old_stat = lstat($linkname); var_dump( chmod($linkname, 0777) ); // clear the stat clearstatcache(); -sleep(2); $new_stat = lstat($linkname); // compare self stats var_dump( compare_self_stat($old_stat) ); diff --git a/ext/standard/tests/file/lstat_stat_variation4.phpt b/ext/standard/tests/file/lstat_stat_variation4.phpt index 27ea0bf24801..8813cc61590a 100644 --- a/ext/standard/tests/file/lstat_stat_variation4.phpt +++ b/ext/standard/tests/file/lstat_stat_variation4.phpt @@ -17,13 +17,13 @@ require "$file_path/file.inc"; $file_name = "$file_path/lstat_stat_variation4.tmp"; $fp = fopen($file_name, "w"); // temp file fclose($fp); +touch($file_name, 946684800); // touch a file check stat, there should be difference in atime echo "*** Testing stat() for file after using touch() on the file ***\n"; $old_stat = stat($file_name); // clear the cache clearstatcache(); -sleep(1); var_dump( touch($file_name) ); $new_stat = stat($file_name); From d23828b26212de6e862e9574b4317d5f1a67f7af Mon Sep 17 00:00:00 2001 From: NickSdot Date: Tue, 28 Jul 2026 20:29:55 +0700 Subject: [PATCH 2/3] Avoid opcache revalidation delays --- ext/opcache/tests/issue0140.phpt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/opcache/tests/issue0140.phpt b/ext/opcache/tests/issue0140.phpt index f61b812fef48..de37d9f7d86a 100644 --- a/ext/opcache/tests/issue0140.phpt +++ b/ext/opcache/tests/issue0140.phpt @@ -16,16 +16,16 @@ file_put_contents(FILENAME, "1\n"); var_dump(is_readable(FILENAME)); include(FILENAME); -var_dump(filemtime(FILENAME)); +$mtime = filemtime(FILENAME); +var_dump($mtime); -sleep(2); file_put_contents(FILENAME, "2\n"); +touch(FILENAME, $mtime + 2); var_dump(is_readable(FILENAME)); include(FILENAME); var_dump(filemtime(FILENAME)); -sleep(2); unlink(FILENAME); var_dump(is_readable(FILENAME)); From 0a058b6901ca1720d5c5441c77191b36b28bf510 Mon Sep 17 00:00:00 2001 From: NickSdot Date: Tue, 28 Jul 2026 20:29:55 +0700 Subject: [PATCH 3/3] Synchronize proc_open tests without fixed delays --- ext/standard/tests/general_functions/bug39322.phpt | 11 +++++++++-- .../tests/general_functions/proc_open_pipes1.phpt | 2 +- .../tests/general_functions/proc_open_pipes2.phpt | 2 +- .../tests/general_functions/proc_open_pipes3.phpt | 2 +- .../tests/general_functions/proc_open_pipes_exit.inc | 2 ++ .../tests/general_functions/proc_open_pipes_sleep.inc | 2 -- .../tests/general_functions/proc_open_sockets1.inc | 5 +++-- .../tests/general_functions/proc_open_sockets1.phpt | 8 +++++++- .../tests/general_functions/proc_open_sockets2.inc | 3 ++- .../tests/general_functions/proc_open_sockets2.phpt | 1 + .../tests/general_functions/proc_open_sockets3.phpt | 1 + 11 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 ext/standard/tests/general_functions/proc_open_pipes_exit.inc delete mode 100644 ext/standard/tests/general_functions/proc_open_pipes_sleep.inc diff --git a/ext/standard/tests/general_functions/bug39322.phpt b/ext/standard/tests/general_functions/bug39322.phpt index 162f2babdaac..80a13df4235d 100644 --- a/ext/standard/tests/general_functions/bug39322.phpt +++ b/ext/standard/tests/general_functions/bug39322.phpt @@ -17,8 +17,15 @@ $pipes = array(); $process = proc_open('/bin/sleep 120', $descriptors, $pipes); proc_terminate($process, 9); -sleep(1); // wait a bit to let the process finish -var_dump(proc_get_status($process)); +$deadline = microtime(true) + 5; +do { + $status = proc_get_status($process); + if (!$status['running']) { + break; + } + usleep(1000); +} while (microtime(true) < $deadline); +var_dump($status); echo "Done!\n"; diff --git a/ext/standard/tests/general_functions/proc_open_pipes1.phpt b/ext/standard/tests/general_functions/proc_open_pipes1.phpt index 9822607c6f7e..16db9b34272d 100644 --- a/ext/standard/tests/general_functions/proc_open_pipes1.phpt +++ b/ext/standard/tests/general_functions/proc_open_pipes1.phpt @@ -8,7 +8,7 @@ for ($i = 3; $i<= 30; $i++) { } $php = getenv("TEST_PHP_EXECUTABLE_ESCAPED"); -$callee = escapeshellarg(__DIR__ . "/proc_open_pipes_sleep.inc"); +$callee = escapeshellarg(__DIR__ . "/proc_open_pipes_exit.inc"); proc_open("$php -n $callee", $spec, $pipes); var_dump(count($spec)); diff --git a/ext/standard/tests/general_functions/proc_open_pipes2.phpt b/ext/standard/tests/general_functions/proc_open_pipes2.phpt index c147a2f37646..140ff699ca9d 100644 --- a/ext/standard/tests/general_functions/proc_open_pipes2.phpt +++ b/ext/standard/tests/general_functions/proc_open_pipes2.phpt @@ -6,7 +6,7 @@ proc_open() with no pipes $spec = array(); $php = getenv("TEST_PHP_EXECUTABLE_ESCAPED"); -$callee = escapeshellarg(__DIR__ . "/proc_open_pipes_sleep.inc"); +$callee = escapeshellarg(__DIR__ . "/proc_open_pipes_exit.inc"); proc_open("$php -n $callee", $spec, $pipes); var_dump(count($spec)); diff --git a/ext/standard/tests/general_functions/proc_open_pipes3.phpt b/ext/standard/tests/general_functions/proc_open_pipes3.phpt index 8f065401eb14..58be70d631c7 100644 --- a/ext/standard/tests/general_functions/proc_open_pipes3.phpt +++ b/ext/standard/tests/general_functions/proc_open_pipes3.phpt @@ -8,7 +8,7 @@ for ($i = 3; $i<= 5; $i++) { } $php = getenv("TEST_PHP_EXECUTABLE_ESCAPED"); -$callee = __DIR__ . "/proc_open_pipes_sleep.inc"; +$callee = __DIR__ . "/proc_open_pipes_exit.inc"; $callee_escaped = escapeshellarg($callee); $spec[$i] = array('pi'); diff --git a/ext/standard/tests/general_functions/proc_open_pipes_exit.inc b/ext/standard/tests/general_functions/proc_open_pipes_exit.inc new file mode 100644 index 000000000000..c79471759288 --- /dev/null +++ b/ext/standard/tests/general_functions/proc_open_pipes_exit.inc @@ -0,0 +1,2 @@ + --EXPECT-- bool(true) diff --git a/ext/standard/tests/general_functions/proc_open_sockets2.inc b/ext/standard/tests/general_functions/proc_open_sockets2.inc index e9a6c9e33dc4..d92310bb8791 100644 --- a/ext/standard/tests/general_functions/proc_open_sockets2.inc +++ b/ext/standard/tests/general_functions/proc_open_sockets2.inc @@ -1,7 +1,8 @@