Skip to content

Commit 9110881

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
Conflicts: ext/spl/tests/SplFileObject_rewind_error001.phpt
2 parents 9d75b9f + 8b6b39f commit 9110881

File tree

84 files changed

+227
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+227
-124
lines changed

ext/ftp/tests/ftp_fget_basic1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717
ftp_set_option($ftp, FTP_AUTOSEEK, false);
1818

19-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
19+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt";
2020
$handle = fopen($local_file, 'w');
2121

2222
var_dump(ftp_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
2323
var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt");
2828
?>
2929
--EXPECT--
3030
bool(true)

ext/ftp/tests/ftp_fget_basic2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt");
2828
?>
2929
--EXPECT--
3030
bool(true)

ext/ftp/tests/ftp_fget_basic3.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt");
2828
?>
2929
--EXPECT--
3030
bool(true)

ext/ftp/tests/ftp_nb_fget_basic1.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717
ftp_set_option($ftp, FTP_AUTOSEEK, false);
1818

19-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
19+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt";
2020
$handle = fopen($local_file, 'w');
2121

2222
var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
2323
var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt");
2828
?>
2929
--EXPECT--
3030
int(2)

ext/ftp/tests/ftp_nb_fget_basic2.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt");
2828
?>
2929
--EXPECT--
3030
int(2)

ext/ftp/tests/ftp_nb_fget_basic3.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1515
ftp_login($ftp, 'user', 'pass');
1616
if (!$ftp) die("Couldn't connect to the server");
1717

18-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
18+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt";
1919
file_put_contents($local_file, 'ASCIIFoo');
2020
$handle = fopen($local_file, 'a');
2121

@@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
2424
?>
2525
--CLEAN--
2626
<?php
27-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
27+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt");
2828
?>
2929
--EXPECT--
3030
int(2)

ext/ftp/tests/ftp_nb_get_large.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
1818
ftp_login($ftp, 'user', 'pass');
1919
if (!$ftp) die("Couldn't connect to the server");
2020

21-
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
21+
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt";
2222
touch($local_file);
2323
ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
2424
$fp = fopen($local_file, 'r');
@@ -29,7 +29,7 @@ fclose($fp);
2929
?>
3030
--CLEAN--
3131
<?php
32-
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
32+
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt");
3333
?>
3434
--EXPECT--
3535
string(1) "X"

ext/spl/tests/SplFileObject_getflags_basic.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ Erwin Poeze <[email protected]>
77
--FILE--
88
<?php
99

10-
file_put_contents('testdata.csv', 'eerste;tweede;derde');
10+
file_put_contents('SplFileObject_getflags_basic.csv', 'eerste;tweede;derde');
1111

12-
$fo = new SplFileObject('testdata.csv');
12+
$fo = new SplFileObject('SplFileObject_getflags_basic.csv');
1313

1414
$fo->setFlags(SplFileObject::DROP_NEW_LINE);
1515
var_dump($fo->getFlags());
1616
?>
1717
--CLEAN--
1818
<?php
19-
unlink('testdata.csv');
19+
unlink('SplFileObject_getflags_basic.csv');
2020
?>
2121
--EXPECT--
2222
int(1)

ext/spl/tests/SplFileObject_getflags_error001.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Erwin Poeze <[email protected]>
77
--FILE--
88
<?php
99

10-
file_put_contents('testdata.csv', 'eerste;tweede;derde');
10+
file_put_contents('SplFileObject_getflags_error001.csv', 'eerste;tweede;derde');
1111

1212

13-
$fo = new SplFileObject('testdata.csv');
13+
$fo = new SplFileObject('SplFileObject_getflags_error001.csv');
1414
$fo->setFlags(SplFileObject::READ_CSV);
1515

1616
$fo->setFlags(SplFileObject::DROP_NEW_LINE);
@@ -20,7 +20,7 @@ var_dump($fo->getFlags());
2020
?>
2121
--CLEAN--
2222
<?php
23-
unlink('testdata.csv');
23+
unlink('SplFileObject_getflags_error001.csv');
2424
?>
2525
--EXPECT--
2626
int(1)

ext/spl/tests/SplFileObject_getflags_error002.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ Erwin Poeze <[email protected]>
55
--FILE--
66
<?php
77

8-
file_put_contents('testdata.csv', 'eerste;tweede;derde');
8+
file_put_contents('SplFileObject_getflags_error002.csv', 'eerste;tweede;derde');
99

10-
$fo = new SplFileObject('testdata.csv');
10+
$fo = new SplFileObject('SplFileObject_getflags_error002.csv');
1111
$fo->setFlags(SplFileObject::READ_CSV);
1212

1313
$fo->getFlags('fake');
1414

1515
?>
1616
--CLEAN--
1717
<?php
18-
unlink('testdata.csv');
18+
unlink('SplFileObject_getflags_error002.csv');
1919
?>
2020
--EXPECTF--
2121
Warning: SplFileObject::getFlags() expects exactly 0 parameters, 1 given in %s on line %d

ext/spl/tests/SplFileObject_rewind_error001.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ Erwin Poeze <[email protected]>
77
--FILE--
88
<?php
99

10-
file_put_contents('testdata.csv', 'eerste;tweede;derde');
10+
file_put_contents('SplFileObject_rewind_error001.csv', 'eerste;tweede;derde');
1111

12-
$fo = new SplFileObject('testdata.csv');
12+
$fo = new SplFileObject('SplFileObject_rewind_error001.csv');
1313

1414
$fo->rewind( "invalid" );
1515

1616
?>
1717
--CLEAN--
1818
<?php
19-
unlink('testdata.csv');
19+
unlink('SplFileObject_rewind_error001.csv');
2020
?>
2121
--EXPECTF--
2222
Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d

ext/standard/tests/file/fgets_socket_variation1.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ Dave Kelsey <[email protected]>
55
--FILE--
66
<?php
77

8-
/* Setup socket server */
9-
$server = stream_socket_server('tcp://127.0.0.1:31337');
8+
for ($i=0; $i<100; $i++) {
9+
$port = rand(10000, 65000);
10+
/* Setup socket server */
11+
$server = @stream_socket_server("tcp://127.0.0.1:$port");
12+
if ($server) {
13+
break;
14+
}
15+
}
1016

1117
/* Connect to it */
12-
$client = fsockopen('tcp://127.0.0.1:31337');
18+
$client = fsockopen("tcp://127.0.0.1:$port");
1319

1420
if (!$client) {
1521
die("Unable to create socket");

ext/standard/tests/file/fgets_socket_variation2.phpt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,17 @@ for ($i = 0; $i < 1000; $i++) {
1616
}
1717
fclose($fd);
1818

19-
/* Setup socket server */
20-
$server = stream_socket_server('tcp://127.0.0.1:31337');
19+
for ($i=0; $i<100; $i++) {
20+
$port = rand(10000, 65000);
21+
/* Setup socket server */
22+
$server = @stream_socket_server("tcp://127.0.0.1:$port");
23+
if ($server) {
24+
break;
25+
}
26+
}
2127

2228
/* Connect to it */
23-
$client = fsockopen('tcp://127.0.0.1:31337');
29+
$client = fsockopen("tcp://127.0.0.1:$port");
2430

2531
if (!$client) {
2632
die("Unable to create socket");

ext/standard/tests/file/file_put_contents_variation9.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ if(substr(PHP_OS, 0, 3) == "WIN")
1717

1818
echo "*** Testing file_put_contents() : usage variation ***\n";
1919

20-
$filename = dirname(__FILE__).'/fileGetContentsVar9.tmp';
21-
$softlink = dirname(__FILE__).'/fileGetContentsVar9.SoftLink';
22-
$hardlink = dirname(__FILE__).'/fileGetContentsVar9.HardLink';
23-
$chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink';
20+
$filename = dirname(__FILE__).'/filePutContentsVar9.tmp';
21+
$softlink = dirname(__FILE__).'/filePutContentsVar9.SoftLink';
22+
$hardlink = dirname(__FILE__).'/filePutContentsVar9.HardLink';
23+
$chainlink = dirname(__FILE__).'/filePutContentsVar9.ChainLink';
2424

2525

2626
// link files even though it original file doesn't exist yet

ext/standard/tests/file/fread_socket_variation1.phpt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@ Testing fread() on a TCP server socket
33
--FILE--
44
<?php
55

6-
$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
6+
for ($i=0; $i<100; $i++) {
7+
$port = rand(10000, 65000);
8+
/* Setup socket server */
9+
$server = @stream_socket_server("tcp://127.0.0.1:$port");
10+
if ($server) {
11+
break;
12+
}
13+
}
714

8-
socket_set_timeout($tcp_socket, 0, 1000);
15+
socket_set_timeout($server, 0, 1000);
916

10-
var_dump(fread($tcp_socket, 1));
17+
var_dump(fread($server, 1));
1118

12-
fclose($tcp_socket);
19+
fclose($server);
1320

1421
?>
1522
--EXPECT--

ext/standard/tests/general_functions/bug41445_1.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Bug #41445 (parse_ini_file() function parses octal numbers in section names) - 2
33
--FILE--
44
<?php
55

6-
$file = dirname(__FILE__)."/bug41445.ini";
6+
$file = dirname(__FILE__)."/bug41445_1.ini";
77

88
$data = <<<DATA
99
[2454.33]

ext/standard/tests/network/fsockopen_basic.phpt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ Test fsockopen() function : basic functionality
1111
echo "*** Testing fsockopen() : basic functionality ***\n";
1212

1313
echo "Open a server socket\n";
14-
$server = stream_socket_server('tcp://127.0.0.1:31337');
1514

15+
for ($i=0; $i<100; $i++) {
16+
$port = rand(10000, 65000);
17+
/* Setup socket server */
18+
$server = @stream_socket_server("tcp://127.0.0.1:$port");
19+
if ($server) {
20+
break;
21+
}
22+
}
1623

1724
// Initialise all required variables
1825
$hostname = 'tcp://127.0.0.1'; // loopback address
19-
$port = 31337;
2026
$errno = null;
2127
$errstr = null;
2228
$timeout = 1.5;

ext/standard/tests/network/fsockopen_variation1.phpt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@ testing fsockopen without a protocol string
44
<?php
55

66
echo "Open a server socket\n";
7-
$server = stream_socket_server('tcp://127.0.0.1:31337');
7+
for ($i=0; $i<100; $i++) {
8+
$port = rand(10000, 65000);
9+
/* Setup socket server */
10+
$server = @stream_socket_server("tcp://127.0.0.1:$port");
11+
if ($server) {
12+
break;
13+
}
14+
}
815

916
echo "\nCalling fsockopen() without a protocol in the hostname string:\n";
1017
$hostname = '127.0.0.1';
11-
$port = '31337';
1218
$client = fsockopen($hostname, $port);
1319
var_dump($client);
1420
fclose($client);

ext/standard/tests/network/shutdown.phpt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,22 @@ stream_socket_shutdown() test on IPv4 TCP Loopback
66
?>
77
--FILE--
88
<?php
9-
/* Setup socket server */
10-
$server = stream_socket_server('tcp://127.0.0.1:31337');
11-
if (!$server) {
9+
10+
for ($i=0; $i<100; $i++) {
11+
$port = rand(10000, 65000);
12+
/* Setup socket server */
13+
$server = @stream_socket_server("tcp://127.0.0.1:$port");
14+
if ($server) {
15+
break;
16+
}
17+
}
18+
19+
if (!$server) {
1220
die('Unable to create AF_INET socket [server]');
1321
}
1422

1523
/* Connect and send request 1 */
16-
$client1 = stream_socket_client('tcp://127.0.0.1:31337');
24+
$client1 = stream_socket_client("tcp://127.0.0.1:$port");
1725
if (!$client1) {
1826
die('Unable to create AF_INET socket [client]');
1927
}
@@ -22,7 +30,7 @@ stream_socket_shutdown() test on IPv4 TCP Loopback
2230
@fwrite($client1, "Error 1\n");
2331

2432
/* Connect and send request 2 */
25-
$client2 = stream_socket_client('tcp://127.0.0.1:31337');
33+
$client2 = stream_socket_client("tcp://127.0.0.1:$port");
2634
if (!$client2) {
2735
die('Unable to create AF_INET socket [client]');
2836
}

ext/standard/tests/network/socket_get_status_basic.phpt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ Testing socket_get_status()
33
--FILE--
44
<?php
55

6-
$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
7-
var_dump(socket_get_status($tcp_socket));
8-
fclose($tcp_socket);
6+
for ($i=0; $i<100; $i++) {
7+
$port = rand(10000, 65000);
8+
/* Setup socket server */
9+
$server = @stream_socket_server("tcp://127.0.0.1:$port");
10+
if ($server) {
11+
break;
12+
}
13+
}
14+
15+
var_dump(socket_get_status($server));
16+
fclose($server);
917

1018
?>
1119
--EXPECTF--

0 commit comments

Comments
 (0)