1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 01:02:25 +01:00
Files
archived-php-src/ext/spl/tests/bug65545.phpt
George Peter Banyard 61c299fe9c Error promotions in SPL
Warning to Error promotion and a Notice to Warning promotion to align
with the behaviour specified in the Reclassify Engine Warnings RFC.

Closes GH-6072
2020-09-03 19:27:02 +02:00

25 lines
507 B
PHP

--TEST--
SplFileObject::fread function
--FILE--
<?php
$obj = new SplFileObject(__FILE__, 'r');
$data = $obj->fread(5);
var_dump($data);
try {
$data = $obj->fread(0);
var_dump($data);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
// read more data than is available
$data = $obj->fread(filesize(__FILE__) + 32);
var_dump(strlen($data) === filesize(__FILE__) - 5);
?>
--EXPECT--
string(5) "<?php"
SplFileObject::fread(): Argument #1 ($length) must be greater than 0
bool(true)