xref: /PHP-8.1/ext/standard/tests/file/bug44034.phpt (revision f8d79582)
1--TEST--
2Bug #44034
3--INI--
4allow_url_fopen=1
5--FILE--
6<?php
7
8$urls = array();
9$urls[] = "data://text/plain,foo\r\nbar\r\n";
10$urls[] = "data://text/plain,\r\nfoo\r\nbar\r\n";
11$urls[] = "data://text/plain,foo\r\nbar";
12
13foreach($urls as $url) {
14    echo strtr($url, array("\r" => "\\r", "\n" => "\\n")) . "\n";
15    var_dump(file($url, FILE_IGNORE_NEW_LINES));
16}
17?>
18--EXPECT--
19data://text/plain,foo\r\nbar\r\n
20array(2) {
21  [0]=>
22  string(3) "foo"
23  [1]=>
24  string(3) "bar"
25}
26data://text/plain,\r\nfoo\r\nbar\r\n
27array(3) {
28  [0]=>
29  string(0) ""
30  [1]=>
31  string(3) "foo"
32  [2]=>
33  string(3) "bar"
34}
35data://text/plain,foo\r\nbar
36array(2) {
37  [0]=>
38  string(3) "foo"
39  [1]=>
40  string(3) "bar"
41}
42