Skip to content

Commit

Permalink
Merge branch 'pull-request/473'
Browse files Browse the repository at this point in the history
  • Loading branch information
sgolemon committed Sep 26, 2013
2 parents 0ceea8a + 361e984 commit 92fe33c
Show file tree
Hide file tree
Showing 74 changed files with 190 additions and 114 deletions.
4 changes: 2 additions & 2 deletions ext/ftp/tests/ftp_fget_basic1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");
ftp_set_option($ftp, FTP_AUTOSEEK, false);

$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt";
$handle = fopen($local_file, 'w');

var_dump(ftp_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
var_dump(file_get_contents($local_file));
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic1.txt");
?>
--EXPECT--
bool(true)
Expand Down
4 changes: 2 additions & 2 deletions ext/ftp/tests/ftp_fget_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");

$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt";
file_put_contents($local_file, 'ASCIIFoo');
$handle = fopen($local_file, 'a');

Expand All @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic2.txt");
?>
--EXPECT--
bool(true)
Expand Down
4 changes: 2 additions & 2 deletions ext/ftp/tests/ftp_fget_basic3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");

$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt";
file_put_contents($local_file, 'ASCIIFoo');
$handle = fopen($local_file, 'a');

Expand All @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_fget_basic3.txt");
?>
--EXPECT--
bool(true)
Expand Down
4 changes: 2 additions & 2 deletions ext/ftp/tests/ftp_nb_fget_basic1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");
ftp_set_option($ftp, FTP_AUTOSEEK, false);

$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt";
$handle = fopen($local_file, 'w');

var_dump(ftp_nb_fget($ftp, $handle, 'fget.txt', FTP_ASCII, FTP_AUTORESUME));
var_dump(file_get_contents($local_file));
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic1.txt");
?>
--EXPECT--
int(2)
Expand Down
4 changes: 2 additions & 2 deletions ext/ftp/tests/ftp_nb_fget_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");

$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt";
file_put_contents($local_file, 'ASCIIFoo');
$handle = fopen($local_file, 'a');

Expand All @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic2.txt");
?>
--EXPECT--
int(2)
Expand Down
4 changes: 2 additions & 2 deletions ext/ftp/tests/ftp_nb_fget_basic3.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");

$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt";
file_put_contents($local_file, 'ASCIIFoo');
$handle = fopen($local_file, 'a');

Expand All @@ -24,7 +24,7 @@ var_dump(file_get_contents($local_file));
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_fget_basic3.txt");
?>
--EXPECT--
int(2)
Expand Down
4 changes: 2 additions & 2 deletions ext/ftp/tests/ftp_nb_get_large.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ftp = ftp_connect('127.0.0.1', $port);
ftp_login($ftp, 'user', 'pass');
if (!$ftp) die("Couldn't connect to the server");

$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt";
$local_file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt";
touch($local_file);
ftp_nb_get($ftp, $local_file, 'fget_large.txt', FTP_BINARY, 5368709119);
$fp = fopen($local_file, 'r');
Expand All @@ -29,7 +29,7 @@ fclose($fp);
?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "localfile.txt");
@unlink(dirname(__FILE__) . DIRECTORY_SEPARATOR . "ftp_nb_get_large.txt");
?>
--EXPECT--
string(1) "X"
Expand Down
6 changes: 3 additions & 3 deletions ext/spl/tests/SplFileObject_getflags_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ Erwin Poeze <[email protected]>
--FILE--
<?php

file_put_contents('testdata.csv', 'eerste;tweede;derde');
file_put_contents('SplFileObject_getflags_basic.csv', 'eerste;tweede;derde');

$fo = new SplFileObject('testdata.csv');
$fo = new SplFileObject('SplFileObject_getflags_basic.csv');

$fo->setFlags(SplFileObject::DROP_NEW_LINE);
var_dump($fo->getFlags());
?>
--CLEAN--
<?php
unlink('testdata.csv');
unlink('SplFileObject_getflags_basic.csv');
?>
--EXPECT--
int(1)
6 changes: 3 additions & 3 deletions ext/spl/tests/SplFileObject_getflags_error001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Erwin Poeze <[email protected]>
--FILE--
<?php

file_put_contents('testdata.csv', 'eerste;tweede;derde');
file_put_contents('SplFileObject_getflags_error001.csv', 'eerste;tweede;derde');


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

$fo->setFlags(SplFileObject::DROP_NEW_LINE);
Expand All @@ -20,7 +20,7 @@ var_dump($fo->getFlags());
?>
--CLEAN--
<?php
unlink('testdata.csv');
unlink('SplFileObject_getflags_error001.csv');
?>
--EXPECT--
int(1)
6 changes: 3 additions & 3 deletions ext/spl/tests/SplFileObject_getflags_error002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ Erwin Poeze <[email protected]>
--FILE--
<?php

file_put_contents('testdata.csv', 'eerste;tweede;derde');
file_put_contents('SplFileObject_getflags_error002.csv', 'eerste;tweede;derde');

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

$fo->getFlags('fake');

?>
--CLEAN--
<?php
unlink('testdata.csv');
unlink('SplFileObject_getflags_error002.csv');
?>
--EXPECTF--
Warning: SplFileObject::getFlags() expects exactly 0 parameters, 1 given in %s on line %d
6 changes: 3 additions & 3 deletions ext/spl/tests/SplFileObject_rewind_error001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ Erwin Poeze <[email protected]>
--FILE--
<?php

file_put_contents('testdata.csv', 'eerste;tweede;derde');
file_put_contents('SplFileObject_rewind_error001.csv', 'eerste;tweede;derde');

$fo = new SplFileObject('testdata.csv');
$fo = new SplFileObject('SplFileObject_rewind_error001.csv');

$fo->rewind( "invalid" );

?>
--CLEAN--
<?php
unlink('testdata.csv');
unlink('SplFileObject_rewind_error001.csv');
?>
--EXPECTF--
Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d
12 changes: 9 additions & 3 deletions ext/standard/tests/file/fgets_socket_variation1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ Dave Kelsey <[email protected]>
--FILE--
<?php

/* Setup socket server */
$server = stream_socket_server('tcp://127.0.0.1:31337');
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
$server = @stream_socket_server("tcp://127.0.0.1:$port");
if ($server) {
break;
}
}

/* Connect to it */
$client = fsockopen('tcp://127.0.0.1:31337');
$client = fsockopen("tcp://127.0.0.1:$port");

if (!$client) {
die("Unable to create socket");
Expand Down
12 changes: 9 additions & 3 deletions ext/standard/tests/file/fgets_socket_variation2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@ for ($i = 0; $i < 1000; $i++) {
}
fclose($fd);

/* Setup socket server */
$server = stream_socket_server('tcp://127.0.0.1:31337');
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
$server = @stream_socket_server("tcp://127.0.0.1:$port");
if ($server) {
break;
}
}

/* Connect to it */
$client = fsockopen('tcp://127.0.0.1:31337');
$client = fsockopen("tcp://127.0.0.1:$port");

if (!$client) {
die("Unable to create socket");
Expand Down
8 changes: 4 additions & 4 deletions ext/standard/tests/file/file_put_contents_variation9.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ if(substr(PHP_OS, 0, 3) == "WIN")

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

$filename = dirname(__FILE__).'/fileGetContentsVar9.tmp';
$softlink = dirname(__FILE__).'/fileGetContentsVar9.SoftLink';
$hardlink = dirname(__FILE__).'/fileGetContentsVar9.HardLink';
$chainlink = dirname(__FILE__).'/fileGetContentsVar9.ChainLink';
$filename = dirname(__FILE__).'/filePutContentsVar9.tmp';
$softlink = dirname(__FILE__).'/filePutContentsVar9.SoftLink';
$hardlink = dirname(__FILE__).'/filePutContentsVar9.HardLink';
$chainlink = dirname(__FILE__).'/filePutContentsVar9.ChainLink';


// link files even though it original file doesn't exist yet
Expand Down
15 changes: 11 additions & 4 deletions ext/standard/tests/file/fread_socket_variation1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ Testing fread() on a TCP server socket
--FILE--
<?php

$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
$server = @stream_socket_server("tcp://127.0.0.1:$port");
if ($server) {
break;
}
}

socket_set_timeout($tcp_socket, 0, 1000);
socket_set_timeout($server, 0, 1000);

var_dump(fread($tcp_socket, 1));
var_dump(fread($server, 1));

fclose($tcp_socket);
fclose($server);

?>
--EXPECT--
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/tests/general_functions/bug41445_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Bug #41445 (parse_ini_file() function parses octal numbers in section names) - 2
--FILE--
<?php

$file = dirname(__FILE__)."/bug41445.ini";
$file = dirname(__FILE__)."/bug41445_1.ini";

$data = <<<DATA
[2454.33]
Expand Down
10 changes: 8 additions & 2 deletions ext/standard/tests/network/fsockopen_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ Test fsockopen() function : basic functionality
echo "*** Testing fsockopen() : basic functionality ***\n";

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

for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
$server = @stream_socket_server("tcp://127.0.0.1:$port");
if ($server) {
break;
}
}

// Initialise all required variables
$hostname = 'tcp://127.0.0.1'; // loopback address
$port = 31337;
$errno = null;
$errstr = null;
$timeout = 1.5;
Expand Down
10 changes: 8 additions & 2 deletions ext/standard/tests/network/fsockopen_variation1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ testing fsockopen without a protocol string
<?php

echo "Open a server socket\n";
$server = stream_socket_server('tcp://127.0.0.1:31337');
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
$server = @stream_socket_server("tcp://127.0.0.1:$port");
if ($server) {
break;
}
}

echo "\nCalling fsockopen() without a protocol in the hostname string:\n";
$hostname = '127.0.0.1';
$port = '31337';
$client = fsockopen($hostname, $port);
var_dump($client);
fclose($client);
Expand Down
18 changes: 13 additions & 5 deletions ext/standard/tests/network/shutdown.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ stream_socket_shutdown() test on IPv4 TCP Loopback
?>
--FILE--
<?php
/* Setup socket server */
$server = stream_socket_server('tcp://127.0.0.1:31337');
if (!$server) {

for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
$server = @stream_socket_server("tcp://127.0.0.1:$port");
if ($server) {
break;
}
}

if (!$server) {
die('Unable to create AF_INET socket [server]');
}

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

/* Connect and send request 2 */
$client2 = stream_socket_client('tcp://127.0.0.1:31337');
$client2 = stream_socket_client("tcp://127.0.0.1:$port");
if (!$client2) {
die('Unable to create AF_INET socket [client]');
}
Expand Down
14 changes: 11 additions & 3 deletions ext/standard/tests/network/socket_get_status_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ Testing socket_get_status()
--FILE--
<?php

$tcp_socket = stream_socket_server('tcp://127.0.0.1:31337');
var_dump(socket_get_status($tcp_socket));
fclose($tcp_socket);
for ($i=0; $i<100; $i++) {
$port = rand(10000, 65000);
/* Setup socket server */
$server = @stream_socket_server("tcp://127.0.0.1:$port");
if ($server) {
break;
}
}

var_dump(socket_get_status($server));
fclose($server);

?>
--EXPECTF--
Expand Down
Loading

0 comments on commit 92fe33c

Please sign in to comment.