Skip to content

run-tests: remove use of FILE_BINARY constant #5556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
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
20 changes: 10 additions & 10 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,8 +966,8 @@ function save_or_mail_results()
if ($sum_results['FAILED']) {
foreach ($PHP_FAILED_TESTS['FAILED'] as $test_info) {
$failed_tests_data .= $sep . $test_info['name'] . $test_info['info'];
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['output']), FILE_BINARY);
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff']), FILE_BINARY);
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['output']));
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff']));
$failed_tests_data .= $sep . "\n\n";
}
$status = "failed";
Expand Down Expand Up @@ -1163,12 +1163,12 @@ function save_text($filename, $text, $filename_copy = null)
global $DETAILED;

if ($filename_copy && $filename_copy != $filename) {
if (file_put_contents($filename_copy, $text, FILE_BINARY) === false) {
if (file_put_contents($filename_copy, $text) === false) {
error("Cannot open file '" . $filename_copy . "' (save_text)");
}
}

if (file_put_contents($filename, $text, FILE_BINARY) === false) {
if (file_put_contents($filename, $text) === false) {
error("Cannot open file '" . $filename . "' (save_text)");
}

Expand Down Expand Up @@ -1890,7 +1890,7 @@ function run_test($php, $file, $env)
$section_text[$key] = dirname($file) . '/' . trim(str_replace('..', '', $section_text[$key]));

if (file_exists($section_text[$key])) {
$section_text[$prefix] = file_get_contents($section_text[$key], FILE_BINARY);
$section_text[$prefix] = file_get_contents($section_text[$key]);
unset($section_text[$key]);
} else {
$bork_info = "could not load --" . $key . "-- " . dirname($file) . '/' . trim($section_text[$key]);
Expand Down Expand Up @@ -2724,12 +2724,12 @@ function run_test($php, $file, $env)
if (!$passed) {

// write .exp
if (strpos($log_format, 'E') !== false && file_put_contents($exp_filename, $wanted, FILE_BINARY) === false) {
if (strpos($log_format, 'E') !== false && file_put_contents($exp_filename, $wanted) === false) {
error("Cannot create expected test output - $exp_filename");
}

// write .out
if (strpos($log_format, 'O') !== false && file_put_contents($output_filename, $output, FILE_BINARY) === false) {
if (strpos($log_format, 'O') !== false && file_put_contents($output_filename, $output) === false) {
error("Cannot create test output - $output_filename");
}

Expand All @@ -2740,7 +2740,7 @@ function run_test($php, $file, $env)
$diff = "# original source file: $orig_shortname\n" . $diff;
}
show_file_block('diff', $diff);
if (strpos($log_format, 'D') !== false && file_put_contents($diff_filename, $diff, FILE_BINARY) === false) {
if (strpos($log_format, 'D') !== false && file_put_contents($diff_filename, $diff) === false) {
error("Cannot create test diff - $diff_filename");
}

Expand All @@ -2763,7 +2763,7 @@ function run_test($php, $file, $env)
;;
esac
SH;
if (strpos($log_format, 'S') !== false && file_put_contents($sh_filename, $sh_script, FILE_BINARY) === false) {
if (strpos($log_format, 'S') !== false && file_put_contents($sh_filename, $sh_script) === false) {
error("Cannot create test shell script - $sh_filename");
}
chmod($sh_filename, 0755);
Expand All @@ -2775,7 +2775,7 @@ function run_test($php, $file, $env)
---- ACTUAL OUTPUT
$output
---- FAILED
", FILE_BINARY) === false) {
") === false) {
error("Cannot create test log - $log_filename");
error_report($file, $log_filename, $tested);
}
Expand Down