xref: /PHP-8.2/ext/standard/tests/file/gh15653.phpt (revision 7db1a584)
1--TEST--
2GH-15653 (fgetcsv overflow on length argument)
3--FILE--
4<?php
5$filename = __DIR__ . "/gh15653.tmp";
6touch($filename);
7$fp = fopen ($filename, "r");
8
9try {
10	fgetcsv($fp, PHP_INT_MAX);
11} catch (\ValueError $e) {
12	echo $e->getMessage() . PHP_EOL;
13}
14
15fgetcsv($fp, PHP_INT_MAX-1);
16--CLEAN--
17<?php
18@unlink(__DIR__ . "/gh15653.tmp");
19?>
20--EXPECTF--
21fgetcsv(): Argument #2 ($length) must be between 0 and %d
22%A
23