Skip to content

Commit b9088ca

Browse files
committed
add test
1 parent 90cdc4d commit b9088ca

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
GH-21700 (_php_stream_seek assertion on SEEK_CUR with resolved negative offset)
3+
--CREDITS--
4+
YuanchengJiang
5+
--FILE--
6+
<?php
7+
class wrapper {
8+
public int $pos = 0;
9+
public $context;
10+
function stream_open($path, $mode, $options, &$opened_path): bool { return true; }
11+
function stream_seek($offset, $whence): bool { $this->pos = $offset; return true; }
12+
function stream_tell(): int { return $this->pos; }
13+
}
14+
stream_wrapper_register("gh21700", "wrapper");
15+
$fp = fopen("gh21700://", "rb");
16+
var_dump(fseek($fp, -1, SEEK_CUR));
17+
var_dump(fseek($fp, 0, SEEK_CUR));
18+
fclose($fp);
19+
?>
20+
--EXPECT--
21+
int(-1)
22+
int(0)

0 commit comments

Comments
 (0)