diff options
author | Peter Kokot <peterkokot@gmail.com> | 2018-10-13 11:23:52 +0200 |
---|---|---|
committer | Peter Kokot <peterkokot@gmail.com> | 2018-10-13 11:23:52 +0200 |
commit | be2ddc6b6575da0b8e7ed235464f7e23c71674c7 (patch) | |
tree | 5874fbbbc1fa30e04b9fc823912bce0ceea92389 /ext/standard/tests | |
parent | 272c629c0a1efff2a6a7c53af8f1632d2bcef252 (diff) | |
download | php-git-be2ddc6b6575da0b8e7ed235464f7e23c71674c7.tar.gz |
Convert CRLF line endings to LF
This patch simplifies line endings tracked in the Git repository and
syncs them to all include the LF style instead of the CRLF files.
Newline characters:
- LF (\n) (*nix and Mac)
- CRLF (\r\n) (Windows)
- CR (\r) (old Mac, obsolete)
To see which line endings are in the index and in the working copy the
following command can be used:
`git ls-files --eol`
Git additionally provides `.gitattributes` file to specify if some files
need to have specific line endings on all platforms (either CRLF or LF).
Changed files shouldn't cause issues on modern Windows platforms because
also Git can do output conversion is core.autocrlf=true is set on
Windows and use CRLF newlines in all files in the working tree.
Unless CRLF files are tracked specifically, Git by default tracks all
files in the index using LF newlines.
Diffstat (limited to 'ext/standard/tests')
-rw-r--r-- | ext/standard/tests/file/ftruncate_bug76422.phpt | 72 | ||||
-rw-r--r-- | ext/standard/tests/file/ftruncate_bug76803.phpt | 76 | ||||
-rw-r--r-- | ext/standard/tests/file/windows_links/bug73962.phpt | 154 | ||||
-rw-r--r-- | ext/standard/tests/streams/bug74090.phpt | 44 |
4 files changed, 173 insertions, 173 deletions
diff --git a/ext/standard/tests/file/ftruncate_bug76422.phpt b/ext/standard/tests/file/ftruncate_bug76422.phpt index 46f52aace9..b149f02c64 100644 --- a/ext/standard/tests/file/ftruncate_bug76422.phpt +++ b/ext/standard/tests/file/ftruncate_bug76422.phpt @@ -1,36 +1,36 @@ ---TEST--
-Bug #76422 ftruncate fails on files > 2GB
---SKIPIF--
-<?php
-if (PHP_INT_SIZE < 8) {
- die('skip.. only valid for 64-bit');
-}
-?>
---FILE--
-<?php
-
-$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test76422";
-
-$file_handle = fopen($fn,'cb');
-
-if (false === $file_handle) {
- die('Cannot open test file :/');
-}
-
-$truncate_offset = 4 * 1024 * 1024 * 1024 + 1;
-$ftruncate_result = ftruncate($file_handle, $truncate_offset);
-
-if (false === $ftruncate_result) {
- die('Truncate has failed :/');
-}
-
-fclose($file_handle);
-var_dump(filesize($fn) >= $truncate_offset);
-?>
---CLEAN--
-<?php
-$fn = dirname(__FILE__) . "/test76422";
-unlink($fn);
-?>
---EXPECT--
-bool(true)
+--TEST-- +Bug #76422 ftruncate fails on files > 2GB +--SKIPIF-- +<?php +if (PHP_INT_SIZE < 8) { + die('skip.. only valid for 64-bit'); +} +?> +--FILE-- +<?php + +$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test76422"; + +$file_handle = fopen($fn,'cb'); + +if (false === $file_handle) { + die('Cannot open test file :/'); +} + +$truncate_offset = 4 * 1024 * 1024 * 1024 + 1; +$ftruncate_result = ftruncate($file_handle, $truncate_offset); + +if (false === $ftruncate_result) { + die('Truncate has failed :/'); +} + +fclose($file_handle); +var_dump(filesize($fn) >= $truncate_offset); +?> +--CLEAN-- +<?php +$fn = dirname(__FILE__) . "/test76422"; +unlink($fn); +?> +--EXPECT-- +bool(true) diff --git a/ext/standard/tests/file/ftruncate_bug76803.phpt b/ext/standard/tests/file/ftruncate_bug76803.phpt index 7e99cf2fb2..fe261e8861 100644 --- a/ext/standard/tests/file/ftruncate_bug76803.phpt +++ b/ext/standard/tests/file/ftruncate_bug76803.phpt @@ -1,38 +1,38 @@ ---TEST--
-Bug #76803 ftruncate changes file pointer
---FILE--
-<?php
-
-$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test76803";
-
-$f = fopen($fn, "w");
-fwrite($f, "Hello");
-ftruncate($f, 2);
-fwrite($f, "World");
-fclose($f);
-var_dump(addslashes(file_get_contents($fn)));
-
-$f = fopen($fn, "w");
-fwrite($f, "Hello");
-ftruncate($f, 2);
-fclose($f);
-var_dump(addslashes(file_get_contents($fn)));
-
-$f = fopen('php://memory', 'w+');
-fwrite($f, 'Hello');
-ftruncate($f, 2); // in 7.3 changes file pointer to 2
-fwrite($f, 'World');
-rewind($f);
-var_dump(addslashes(stream_get_contents($f)));
-fclose($f);
-
-?>
---CLEAN--
-<?php
-$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test76803";
-unlink($fn);
-?>
---EXPECT--
-string(13) "He\0\0\0World"
-string(2) "He"
-string(7) "HeWorld"
+--TEST-- +Bug #76803 ftruncate changes file pointer +--FILE-- +<?php + +$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test76803"; + +$f = fopen($fn, "w"); +fwrite($f, "Hello"); +ftruncate($f, 2); +fwrite($f, "World"); +fclose($f); +var_dump(addslashes(file_get_contents($fn))); + +$f = fopen($fn, "w"); +fwrite($f, "Hello"); +ftruncate($f, 2); +fclose($f); +var_dump(addslashes(file_get_contents($fn))); + +$f = fopen('php://memory', 'w+'); +fwrite($f, 'Hello'); +ftruncate($f, 2); // in 7.3 changes file pointer to 2 +fwrite($f, 'World'); +rewind($f); +var_dump(addslashes(stream_get_contents($f))); +fclose($f); + +?> +--CLEAN-- +<?php +$fn = dirname(__FILE__) . DIRECTORY_SEPARATOR . "test76803"; +unlink($fn); +?> +--EXPECT-- +string(13) "He\0\0\0World" +string(2) "He" +string(7) "HeWorld" diff --git a/ext/standard/tests/file/windows_links/bug73962.phpt b/ext/standard/tests/file/windows_links/bug73962.phpt index 6d578386e6..9be48c7eeb 100644 --- a/ext/standard/tests/file/windows_links/bug73962.phpt +++ b/ext/standard/tests/file/windows_links/bug73962.phpt @@ -1,77 +1,77 @@ ---TEST--
-Bug #73962 bug with symlink related to cyrillic directory
---SKIPIF--
-<?php
-if(substr(PHP_OS, 0, 3) != 'WIN' ) {
- die('skip windows only test');
-}
-include_once __DIR__ . '/common.inc';
-$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out);
-if (strpos($ret, 'privilege')) {
- die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.');
-}
-unlink('bug48746_tmp.lnk');
-?>
---FILE--
-<?php
-include_once __DIR__ . '/common.inc';
-$mountvol = get_mountvol();
-$old_dir = __DIR__;
-$dirname = '"' . __DIR__ . "\\mnt\\test\\новая папка" . '"';
-exec("mkdir " . $dirname, $output, $ret_val);
-chdir(__DIR__ . "\\mnt\\test");
-$drive = substr(__DIR__, 0, 2);
-$pathwithoutdrive = substr(__DIR__, 2);
-$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val);
-exec("mklink /d mounted_volume " . $ret, $output, $ret_val);
-$fullpath = "mounted_volume" . $pathwithoutdrive;
-exec("mklink /d mklink_symlink \"новая папка\"", $output, $ret_val);
-file_put_contents("mklink_symlink\\a.php", "<?php echo \"I am included.\n\" ?>");
-file_put_contents("$fullpath\\mnt\\test\\новая папка\\b.php", "<?php echo \"I am included.\n\" ?>");
-var_dump(scandir("mklink_symlink"));
-var_dump(scandir("$fullpath\\mnt\\test\\новая папка"));
-var_dump(scandir("$fullpath\\mnt\\test\\mklink_symlink"));
-var_dump(is_readable("$fullpath\\mnt\\test\\mklink_symlink\b.php"));
-unlink("$fullpath\\mnt\\test\\новая папка\\b.php");
-unlink("mklink_symlink\\a.php");
-chdir($old_dir);
-rmdir(__DIR__ . "\\mnt\\test\\новая папка");
-rmdir(__DIR__ . "\\mnt\\test\\mklink_symlink");
-rmdir(__DIR__ . "\\mnt\\test\\mounted_volume");
-rmdir(__DIR__ . "\\mnt\\test");
-rmdir(__DIR__ . "\\mnt");
-
-?>
---EXPECT--
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-array(4) {
- [0]=>
- string(1) "."
- [1]=>
- string(2) ".."
- [2]=>
- string(5) "a.php"
- [3]=>
- string(5) "b.php"
-}
-bool(true)
-
+--TEST-- +Bug #73962 bug with symlink related to cyrillic directory +--SKIPIF-- +<?php +if(substr(PHP_OS, 0, 3) != 'WIN' ) { + die('skip windows only test'); +} +include_once __DIR__ . '/common.inc'; +$ret = exec('mklink bug48746_tmp.lnk ' . __FILE__ .' 2>&1', $out); +if (strpos($ret, 'privilege')) { + die('skip. SeCreateSymbolicLinkPrivilege not enable for this user.'); +} +unlink('bug48746_tmp.lnk'); +?> +--FILE-- +<?php +include_once __DIR__ . '/common.inc'; +$mountvol = get_mountvol(); +$old_dir = __DIR__; +$dirname = '"' . __DIR__ . "\\mnt\\test\\новая папка" . '"'; +exec("mkdir " . $dirname, $output, $ret_val); +chdir(__DIR__ . "\\mnt\\test"); +$drive = substr(__DIR__, 0, 2); +$pathwithoutdrive = substr(__DIR__, 2); +$ret = exec($mountvol . " " . $drive . " /L", $output, $ret_val); +exec("mklink /d mounted_volume " . $ret, $output, $ret_val); +$fullpath = "mounted_volume" . $pathwithoutdrive; +exec("mklink /d mklink_symlink \"новая папка\"", $output, $ret_val); +file_put_contents("mklink_symlink\\a.php", "<?php echo \"I am included.\n\" ?>"); +file_put_contents("$fullpath\\mnt\\test\\новая папка\\b.php", "<?php echo \"I am included.\n\" ?>"); +var_dump(scandir("mklink_symlink")); +var_dump(scandir("$fullpath\\mnt\\test\\новая папка")); +var_dump(scandir("$fullpath\\mnt\\test\\mklink_symlink")); +var_dump(is_readable("$fullpath\\mnt\\test\\mklink_symlink\b.php")); +unlink("$fullpath\\mnt\\test\\новая папка\\b.php"); +unlink("mklink_symlink\\a.php"); +chdir($old_dir); +rmdir(__DIR__ . "\\mnt\\test\\новая папка"); +rmdir(__DIR__ . "\\mnt\\test\\mklink_symlink"); +rmdir(__DIR__ . "\\mnt\\test\\mounted_volume"); +rmdir(__DIR__ . "\\mnt\\test"); +rmdir(__DIR__ . "\\mnt"); + +?> +--EXPECT-- +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(5) "a.php" + [3]=> + string(5) "b.php" +} +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(5) "a.php" + [3]=> + string(5) "b.php" +} +array(4) { + [0]=> + string(1) "." + [1]=> + string(2) ".." + [2]=> + string(5) "a.php" + [3]=> + string(5) "b.php" +} +bool(true) + diff --git a/ext/standard/tests/streams/bug74090.phpt b/ext/standard/tests/streams/bug74090.phpt index 47efc2c7cd..f6187003fa 100644 --- a/ext/standard/tests/streams/bug74090.phpt +++ b/ext/standard/tests/streams/bug74090.phpt @@ -1,22 +1,22 @@ ---TEST--
-Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows
---SKIPIF--
-<?php
-if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); }
-if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); }
-?>
---FILE--
-<?php
-$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE=");
-$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT);
-stream_set_blocking($fd, 0);
-stream_socket_sendto($fd,$data);
-sleep(1);
-$ret = stream_get_contents($fd,65565);
-var_dump(strlen($ret) > 0);
-stream_socket_shutdown($fd,STREAM_SHUT_RDWR);
-?>
-==DONE==
---EXPECT--
-bool(true)
-==DONE==
+--TEST-- +Bug #74090 stream_get_contents maxlength>-1 returns empty string on windows +--SKIPIF-- +<?php +if (getenv("SKIP_ONLINE_TESTS")) { die('skip: online test'); } +if (getenv("SKIP_SLOW_TESTS")) { die('skip: slow test'); } +?> +--FILE-- +<?php +$data = base64_decode("1oIBAAABAAAAAAAAB2V4YW1wbGUDb3JnAAABAAE="); +$fd = stream_socket_client("udp://8.8.8.8:53", $errno, $errstr, 0, STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT); +stream_set_blocking($fd, 0); +stream_socket_sendto($fd,$data); +sleep(1); +$ret = stream_get_contents($fd,65565); +var_dump(strlen($ret) > 0); +stream_socket_shutdown($fd,STREAM_SHUT_RDWR); +?> +==DONE== +--EXPECT-- +bool(true) +==DONE== |