Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ext/opcache/tests/issue0140.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/file/001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/tests/file/lstat_stat_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/file/lstat_stat_variation10.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/file/lstat_stat_variation11.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/file/lstat_stat_variation13.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion ext/standard/tests/file/lstat_stat_variation15.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) );
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/file/lstat_stat_variation4.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
11 changes: 9 additions & 2 deletions ext/standard/tests/general_functions/bug39322.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
exit;

This file was deleted.

5 changes: 3 additions & 2 deletions ext/standard/tests/general_functions/proc_open_sockets1.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

echo "hello";
sleep(1);
fgets(STDIN);
fwrite(STDERR, "SOME ERROR");
sleep(1);
fgets(STDIN);
echo "world";
fgets(STDIN);
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ $cmd = [
];

$spec = [
['null'],
['pipe', 'r'],
['socket'],
['socket']
];

$proc = proc_open($cmd, $spec, $pipes);
$control = $pipes[0];
unset($pipes[0]);

foreach ($pipes as $pipe) {
var_dump(stream_set_blocking($pipe, false));
Expand Down Expand Up @@ -47,10 +49,14 @@ while ($pipes) {

if ($chunk !== '') {
echo "PIPE {$i} << {$chunk}\n";
// Let the child emit the next chunk.
fwrite($control, "\n");
}
}
}

fclose($control);

?>
--EXPECT--
bool(true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

echo "hello";
sleep(1);
// Wait until the parent has read the first chunk.
fgets(STDIN);
echo "world";

echo strtoupper(trim(fgets(STDIN)));
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ foreach ($pipes as $pipe) {
}

printf("STDOUT << %s\n", read_pipe($pipes[1]));
write_pipe($pipes[0], "continue\n");
printf("STDOUT << %s\n", read_pipe($pipes[1]));

write_pipe($pipes[0], 'done');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ $proc = proc_open($cmd, $spec, $pipes);
var_dump(stream_set_blocking($pipes[1], false));

printf("STDOUT << %s\n", read_pipe($pipes[1]));
fwrite($pipes[0], "continue\n");
printf("STDOUT << %s\n", read_pipe($pipes[1]));

fwrite($pipes[0], 'done');
Expand Down
Loading