summaryrefslogtreecommitdiff
path: root/ext/standard/tests/file/fwrite.phpt
blob: 443710b99d0421da7581b8eff43fb003c2ac9a22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--TEST--
fwrite() tests
--FILE--
<?php

$filename = dirname(__FILE__)."/fwrite.dat";

$fp = fopen($filename, "w");
var_dump(fwrite($fp));
var_dump(fwrite($fp, array()));
fclose($fp);

$fp = fopen($filename, "r");
var_dump(fwrite($fp, "data"));

$fp = fopen($filename, "w");
var_dump(fwrite($fp, "data", -1));
var_dump(fwrite($fp, "data", 100000));
fclose($fp);

var_dump(fwrite($fp, "data", -1));

var_dump(fwrite(array(), "data", -1));
var_dump(fwrite(array(), "data"));
var_dump(fwrite(array()));

var_dump(file_get_contents($filename));

@unlink($filename);
echo "Done\n";
?>
--EXPECTF--
Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
bool(false)

Warning: fwrite() expects parameter 2 to be string, array given in %s on line %d
bool(false)
int(0)
int(0)
int(4)
int(0)

Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
bool(false)

Warning: fwrite() expects parameter 1 to be resource, array given in %s on line %d
bool(false)

Warning: fwrite() expects at least 2 parameters, 1 given in %s on line %d
bool(false)
string(4) "data"
Done