Remove the binary cast from unrelated tests

This commit is contained in:
Pedro Magalhães 2016-11-20 18:37:06 +01:00 committed by Nikita Popov
parent 9c5af4e4cb
commit 617dcf1b37
53 changed files with 69 additions and 69 deletions

View File

@ -1,3 +1,3 @@
<?php
var_dump((binary)__NAMESPACE__);
var_dump(__NAMESPACE__);

View File

@ -7,9 +7,9 @@ namespace foo;
class Test {
static function f() {
var_dump((binary)__NAMESPACE__);
var_dump(__NAMESPACE__);
include __DIR__ . '/ns_069.inc';
var_dump((binary)__NAMESPACE__);
var_dump(__NAMESPACE__);
}
}

View File

@ -6,7 +6,7 @@ Bug #40836 (Segfault in insertBefore)
<?php
$dom = new DOMDocument("1.0", "UTF-8");
$dom->preserveWhiteSpace = false;
$xml = (binary)'<?xml version="1.0" encoding="utf-8"?>
$xml = '<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<entry xmlns="http://www.w3.org/2005/Atom">
<updated>2007-02-14T00:00:00+01:00</updated>

View File

@ -4,7 +4,7 @@ Bug #41374 (wholetext concats values of wrong nodes)
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
$xml = (binary)<<<EOXML
$xml = <<<EOXML
<?xml version="1.0" encoding="ISO-8859-1" ?>
<root>foo<child />baz</root>
EOXML;

View File

@ -46,7 +46,7 @@ if (!$IS_MYSQLND)
printf("[004] Cannot create trace file to test append mode\n");
} else {
if (!fwrite($fp, (binary) 'mysqli_debug.phpt test line'))
if (!fwrite($fp, 'mysqli_debug.phpt test line'))
printf("[005] Cannot write to trace file.\n");
fclose($fp);

View File

@ -69,7 +69,7 @@ var_dump($row);
echo "Test 2 Manipulate the data using SimpleXML\n";
$sx = simplexml_load_string((binary)$row[0]->load());
$sx = simplexml_load_string($row[0]->load());
$row[0]->free();
var_dump($sx);

View File

@ -10,7 +10,7 @@ if (!getenv("TEST_PHP_EXECUTABLE") || !is_executable(getenv("TEST_PHP_EXECUTABLE
--FILE--
<?php
if (getenv("PCNTL_EXEC_TEST_IS_CHILD")) {
var_dump((binary)getenv("FOO"));
var_dump(getenv("FOO"));
exit;
}
echo "ok\n";

View File

@ -9,7 +9,7 @@ phar.require_hash=0
$file = "<?php
Phar::mapPhar('hio');
__HALT_COMPILER(); ?>";
$file .= (binary) pack(b'VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . (binary) str_repeat((binary)'A', 500);
$file .= pack('VVnVVV', 500, 500, 0x1000, 0x00000000, 0, 0) . str_repeat('A', 500);
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';

View File

@ -5,7 +5,7 @@ Bug #39760 (autocreating element doesn't assign value to first node)
--FILE--
<?php
$sx1 = new SimpleXMLElement((binary)"<root />");
$sx1 = new SimpleXMLElement("<root />");
$sx1->node[0] = 'node1';
$sx1->node[1] = 'node2';

View File

@ -25,7 +25,7 @@ $xml =<<<EOF
</sxe>
EOF;
var_dump(simplexml_load_string((binary)$xml, 'SimpleXMLIterator'));
var_dump(simplexml_load_string($xml, 'SimpleXMLIterator'));
?>
===DONE===

View File

@ -35,7 +35,7 @@ $xml =<<<EOF
</sxe>
EOF;
$sxe = simplexml_load_string((binary)$xml, 'SimpleXMLIterator');
$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
foreach(new RecursiveIteratorIterator($sxe, 1) as $name => $data) {
var_dump($name);

View File

@ -35,7 +35,7 @@ $xml =<<<EOF
</sxe>
EOF;
$sxe = simplexml_load_string((binary)$xml, 'SimpleXMLIterator');
$sxe = simplexml_load_string($xml, 'SimpleXMLIterator');
foreach($sxe->getChildren() as $name => $data) {
var_dump($name);

View File

@ -74,7 +74,7 @@ class SXETest extends SimpleXMLIterator
}
}
$sxe = new SXETest((binary)$xml);
$sxe = new SXETest($xml);
$rit = new RecursiveIteratorIterator($sxe, RecursiveIteratorIterator::SELF_FIRST);
foreach($rit as $data) {

View File

@ -26,7 +26,7 @@ class SXETest extends SimpleXMLIterator
}
}
$sxe = new SXETest((binary)$xml);
$sxe = new SXETest($xml);
var_dump(count($sxe));
var_dump(count($sxe->elem1));

View File

@ -46,7 +46,7 @@ stream_wrapper_register("myFile", "FileStream")
or die("Failed to register protocol");
$tmp_dir = __DIR__;
$tn = (binary) tempnam($tmp_dir, 'foo');
$tn = tempnam($tmp_dir, 'foo');
if (!$tn) {
die("tempnam failed");
}

View File

@ -49,7 +49,7 @@ while ($pipes || $writePipes) {
}
if ($w) {
$written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
$written = fwrite($writePipes[0], substr($stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}

View File

@ -30,7 +30,7 @@ var_dump( $space1 );
$fh = fopen($file_path.$dir."/disk_free_space.tmp", "a");
$data = str_repeat("x", 0xffff);
fwrite($fh, (binary)$data);
fwrite($fh, $data);
fclose($fh);
echo "\n Free Space after writing to a file\n";

View File

@ -27,7 +27,7 @@ var_dump( disk_free_space( $file_path."/dir1" )); // Invalid directory
var_dump( diskfreespace( $file_path."/dir1" ));
$fh = fopen( $file_path."/disk_free_space.tmp", "w" );
fwrite( $fh, (binary)" Garbage data for the temporary file" );
fwrite( $fh, " Garbage data for the temporary file" );
var_dump( disk_free_space( $file_path."/disk_free_space.tmp" )); // file input instead of directory
var_dump( diskfreespace( $file_path."/disk_free_space.tmp" ));
fclose($fh);

View File

@ -20,7 +20,7 @@ $dir = "/disk_total_space";
mkdir($file_path.$dir);
var_dump( disk_total_space($file_path.$dir) );
$fh = fopen($file_path.$dir."/disk_total_space.tmp", "w");
fwrite($fh, (binary)"Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data");
fwrite($fh, "Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data Garbage Data");
fclose($fh);

View File

@ -24,7 +24,7 @@ var_dump( disk_total_space( $file_path, "extra argument") ); // More than valid
var_dump( disk_total_space( $file_path."/dir1" )); // Invalid directory
$fh = fopen( $file_path."/disk_total_space.tmp", "w" );
fwrite( $fh, (binary)" Garbage data for the temporary file" );
fwrite( $fh, " Garbage data for the temporary file" );
var_dump( disk_total_space( $file_path."/disk_total_space.tmp" )); // file input instead of directory
fclose($fh);

View File

@ -37,7 +37,7 @@ function runtest() {
global $filename;
//correct php53 behaviour is to ingnore the FILE_USE_INCLUDE_PATH unless the file alread exists
// in the include path. In this case it doesn't so the file should be written in the current dir.
file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH);
$line = file_get_contents($filename);
echo "$line\n";
unlink($filename);

View File

@ -30,7 +30,7 @@ rmdir($thisTestDir);
function runtest() {
global $scriptLocFile, $filename;
file_put_contents($filename, (binary) "File written in working directory", FILE_USE_INCLUDE_PATH);
file_put_contents($filename, "File written in working directory", FILE_USE_INCLUDE_PATH);
if(file_exists($scriptLocFile)) {
echo "Fail - this is PHP52 behaviour\n";
unlink($scriptLocFile);

View File

@ -40,8 +40,8 @@ function runtest() {
//correct php53 behaviour is to ignore the FILE_USE_INCLUDE_PATH unless the file already exists
// in the include path. In this case it doesn't so the file should be written in the current dir.
file_put_contents($filename, (binary) "File in include path", FILE_USE_INCLUDE_PATH);
file_put_contents($filename, (binary) ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND);
file_put_contents($filename, "File in include path", FILE_USE_INCLUDE_PATH);
file_put_contents($filename, ". This was appended", FILE_USE_INCLUDE_PATH | FILE_APPEND);
$line = file_get_contents($filename);
echo "$line\n";
unlink($filename);

View File

@ -16,7 +16,7 @@ $file_path = dirname(__FILE__);
foreach( $data_array as $data ) {
echo "--Iteration $count --\n";
$fh = fopen($file_path."/file_variation.tmp", "w");
fwrite($fh, (binary)$data);
fwrite($fh, $data);
var_dump( file($file_path."/file_variation.tmp", FILE_IGNORE_NEW_LINES) );
var_dump( file($file_path."/file_variation.tmp", FILE_SKIP_EMPTY_LINES) );
$count++;
@ -35,7 +35,7 @@ var_dump( file($file_path1."/file1_variation.tmp", 1) );
echo "*** Using file function to remove line containing a key string ***\n";
$file_handle = fopen($file_path."/file2_variation.tmp", "w");
$key = "SEARCH_KEY";
fwrite( $file_handle, (binary)"The key string to be searched is SEARCH_KEY\nLine without key string\nThe key string to be searched is SEARCH_KEY" );
fwrite( $file_handle,"The key string to be searched is SEARCH_KEY\nLine without key string\nThe key string to be searched is SEARCH_KEY" );
$out_array = file($file_path."/file2_variation.tmp");
echo "File contents in array form Before replacement of the key\n";

View File

@ -18,7 +18,7 @@ $file_path = dirname(__FILE__);
echo "*** Testing filesize(): usage variations ***\n";
$filename = $file_path."/filesize_variation3.tmp";
$file_handle = fopen($filename, "w");
fwrite($file_handle, (binary)str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
fwrite($file_handle, str_repeat("Hello,World ", 1000) ); // create file of size 12000 bytes
fclose($file_handle);
echo "-- Testing filesize() after truncating the file to a new length --\n";

View File

@ -18,7 +18,7 @@ restore_include_path();
function testme() {
$tmpfile = basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w", true);
fwrite($h, (binary) "This is the test file");
fwrite($h, "This is the test file");
fclose($h);

View File

@ -40,7 +40,7 @@ function runtest() {
$tmpfile = $extraDir.'/fopen_variation16.tmp';
$h = fopen($tmpfile, "w+", true);
fwrite($h, (binary) "This is the test file");
fwrite($h, "This is the test file");
fclose($h);
$h = @fopen($dir1.'/'.$tmpfile, "r");

View File

@ -39,7 +39,7 @@ function runtest() {
$tmpfile = $extraDir . '/' . basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w+", true);
fwrite($h, (binary) "This is the test file");
fwrite($h, "This is the test file");
fclose($h);
$h = @fopen($dir1.'/'.$tmpfile, "r");

View File

@ -63,7 +63,7 @@ function test_fopen($mode) {
// create a file in the middle directory
$h = fopen($secondFile, "w");
fwrite($h, (binary) "in dir2");
fwrite($h, "in dir2");
fclose($h);
echo "\n** testing with mode=$mode **\n";
@ -75,7 +75,7 @@ function test_fopen($mode) {
//create a file in dir1
$h = fopen($firstFile, "w");
fwrite($h, (binary) "in dir1");
fwrite($h, "in dir1");
fclose($h);
//should now read dir1 file
@ -86,7 +86,7 @@ function test_fopen($mode) {
// create a file in working directory
$h = fopen($filename, "w");
fwrite($h, (binary) "in working dir");
fwrite($h, "in working dir");
fclose($h);
//should still read dir1 file
@ -106,7 +106,7 @@ function test_fopen($mode) {
// create a file in the script directory
$h = fopen($scriptFile, "w");
fwrite($h, (binary) "in script dir");
fwrite($h, "in script dir");
fclose($h);
//should read the file in script dir

View File

@ -32,7 +32,7 @@ function runtest() {
global $dir1;
$tmpfile = basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w", true);
fwrite($h, (binary)"This is the test file");
fwrite($h, "This is the test file");
fclose($h);

View File

@ -62,7 +62,7 @@ function test_fopen($mode) {
// create a file in the middle directory
$h = fopen($secondFile, "w");
fwrite($h, (binary) "in dir2");
fwrite($h, "in dir2");
fclose($h);
echo "\n** testing with mode=$mode **\n";
@ -74,7 +74,7 @@ function test_fopen($mode) {
//create a file in dir1
$h = fopen($firstFile, "w");
fwrite($h, (binary) "in dir1");
fwrite($h, "in dir1");
fclose($h);
//should now read dir1 file
@ -85,7 +85,7 @@ function test_fopen($mode) {
// create a file in working directory
$h = fopen($filename, "w");
fwrite($h, (binary) "in working dir");
fwrite($h, "in working dir");
fclose($h);
//should read the dir1 file
@ -105,7 +105,7 @@ function test_fopen($mode) {
// create a file in the script directory
$h = fopen($scriptFile, "w");
fwrite($h, (binary) "in script dir");
fwrite($h, "in script dir");
fclose($h);
//should read the file in script dir

View File

@ -32,7 +32,7 @@ rmdir($thisTestDir);
function runtest() {
$tmpfile = basename(__FILE__, ".php") . ".tmp";
$h = fopen($tmpfile, "w", true);
fwrite($h, (binary) "This is the test file");
fwrite($h, "This is the test file");
fclose($h);

View File

@ -49,7 +49,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
// set file pointer to 0
var_dump( rewind($file_handle) ); // set to beginning of file

View File

@ -49,7 +49,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
// set file pointer to 0
var_dump( rewind($file_handle) ); // set to beginning of file

View File

@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
// set file pointer to 0
var_dump( rewind($file_handle) ); // set to beginning of file

View File

@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
echo "-- Testing fseek() without using argument whence --\n";

View File

@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
echo "-- Testing fseek() without using argument whence --\n";

View File

@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){

View File

@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){

View File

@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){

View File

@ -47,7 +47,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){

View File

@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){

View File

@ -48,7 +48,7 @@ foreach($file_content_types as $file_content_type){
$data_to_be_written="";
fill_buffer($data_to_be_written, $file_content_type, 512); //get the data of size 512
$data_to_be_written = $data_to_be_written;
fwrite($file_handle,(binary)$data_to_be_written);
fwrite($file_handle,$data_to_be_written);
rewind($file_handle);
foreach($offset as $count){

View File

@ -11,7 +11,7 @@ echo "*** Testing ftruncate() : error conditions ***\n";
$filename = dirname(__FILE__)."/ftruncate_error.tmp";
$file_handle = fopen($filename, "w" );
fwrite($file_handle, (binary)"Testing ftruncate error conditions \n");
fwrite($file_handle, "Testing ftruncate error conditions \n");
fflush($file_handle);
echo "\n Initial file size = ".filesize($filename)."\n";

View File

@ -29,7 +29,7 @@ echo "*** Testing stat() on file after data is written in it ***\n";
$fh = fopen($file_name,"w");
$old_stat = stat($file_name);
clearstatcache();
fwrite($fh, str_repeat((binary)"Hello World", $old_stat['blksize']));
fwrite($fh, str_repeat("Hello World", $old_stat['blksize']));
$new_stat = stat($file_name);
// compare self stats

View File

@ -47,8 +47,8 @@ $file_handle = popen("sort", "w");
$counter = 0;
$newline = "\n";
foreach($arr as $str) {
fwrite($file_handle, (binary)$str);
fwrite($file_handle, (binary)$newline);
fwrite($file_handle, $str);
fwrite($file_handle, $newline);
}
pclose($file_handle);

View File

@ -67,7 +67,7 @@ for ($i = 0; $i < 30; $i++) {
/* store the data in a regular file so that we can compare
* the results */
$tf = tmpfile();
fwrite($tf, (binary)$DATA);
fwrite($tf, $DATA);
$n = ftell($tf);
rewind($tf) or die("failed to rewind tmp file!");
if (ftell($tf) != 0)

View File

@ -9,10 +9,10 @@ if (!function_exists("inet_pton")) die("skip no inet_pton()");
<?php
$packed = chr(127) . chr(0) . chr(0) . chr(1);
var_dump(inet_ntop((binary)$packed));
var_dump(inet_ntop($packed));
$packed = chr(255) . chr(255) . chr(255) . chr(0);
var_dump(inet_ntop((binary)$packed));
var_dump(inet_ntop($packed));
var_dump(inet_ntop());
var_dump(inet_ntop(-1));

View File

@ -38,7 +38,7 @@ while ($pipes || $writePipes) {
}
if ($w) {
$written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
$written = fwrite($writePipes[0], substr($stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}

View File

@ -38,7 +38,7 @@ while ($pipes || $writePipes) {
}
if ($w) {
$written = fwrite($writePipes[0], (binary)substr($stdin, $stdinOffset), 8192);
$written = fwrite($writePipes[0], substr($stdin, $stdinOffset), 8192);
if (false !== $written) {
$stdinOffset += $written;
}

View File

@ -9,13 +9,13 @@ var_dump(convert_cyr_string("", ""));
var_dump(convert_cyr_string("", "", ""));
var_dump(convert_cyr_string(array(), array(), array()));
var_dump(convert_cyr_string((binary)"[[[[[[", "q", "m"));
var_dump(convert_cyr_string((binary)"[[[[[[", "k", "w"));
var_dump(convert_cyr_string((binary)"[[[[[[", "m", "a"));
var_dump(convert_cyr_string((binary)"[[[[[[", "d", "i"));
var_dump(convert_cyr_string((binary)"[[[[[[", "w", "k"));
var_dump(convert_cyr_string((binary)"[[[[[[", "i", "q"));
var_dump(convert_cyr_string((binary)"", "d", "i"));
var_dump(convert_cyr_string("[[[[[[", "q", "m"));
var_dump(convert_cyr_string("[[[[[[", "k", "w"));
var_dump(convert_cyr_string("[[[[[[", "m", "a"));
var_dump(convert_cyr_string("[[[[[[", "d", "i"));
var_dump(convert_cyr_string("[[[[[[", "w", "k"));
var_dump(convert_cyr_string("[[[[[[", "i", "q"));
var_dump(convert_cyr_string("", "d", "i"));
echo "Done\n";
?>

View File

@ -18,7 +18,7 @@ var_dump(str_getcsv('.foo..bar.', '.', '.', '.'));
print "-----\n";
var_dump(str_getcsv('.foo. .bar.', ' ', '.', '.'));
print "-----\n";
var_dump(str_getcsv((binary)'1foo1 1bar111', (binary)' ', (binary)'1 ', (binary) '\ '));
var_dump(str_getcsv('1foo1 1bar111', ' ', '1 ', '\ '));
print "-----\n";
var_dump(str_getcsv('.foo . . bar .', ' ', '.', ''));
print "-----\n";