blob: eed35b30015e28e7fd698e6de8a33532e8cf839c (
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
|
--TEST--
Test fgets() function : error conditions
--FILE--
<?php
/*
Prototype: string fgets ( resource $handle [, int $length] );
Description: Gets line from file pointer
*/
echo "*** Testing error conditions ***\n";
$fp = fopen(__FILE__, "r");
// invalid length argument
echo "-- Testing fgets() with invalid length arguments --\n";
$len = 0;
var_dump( fgets($fp, $len) );
$len = -10;
var_dump( fgets($fp, $len) );
$len = 1;
var_dump( fgets($fp, $len) ); // return length - 1 always, expect false
echo "Done\n";
?>
--EXPECTF--
*** Testing error conditions ***
-- Testing fgets() with invalid length arguments --
Warning: fgets(): Length parameter must be greater than 0 in %s on line %d
bool(false)
Warning: fgets(): Length parameter must be greater than 0 in %s on line %d
bool(false)
bool(false)
Done
|