xref: /PHP-8.3/ext/standard/tests/file/bug71882.phpt (revision 50765075)
1--TEST--
2Bug #71882 (Negative ftruncate() on php://memory exhausts memory)
3--FILE--
4<?php
5$fd = fopen("php://memory", "w+");
6try {
7    var_dump(ftruncate($fd, -1));
8} catch (\ValueError $e) {
9    echo $e->getMessage() . \PHP_EOL;
10}
11?>
12--EXPECT--
13ftruncate(): Argument #2 ($size) must be greater than or equal to 0
14