mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
This commit is contained in:
commit
dc93f28381
3 changed files with 18 additions and 1 deletions
13
ext/standard/tests/file/gh18212.phpt
Normal file
13
ext/standard/tests/file/gh18212.phpt
Normal file
|
@ -0,0 +1,13 @@
|
|||
--TEST--
|
||||
GH-18212: fseek with SEEK_CUR and negative offset leads to negative file stream position.
|
||||
--FILE--
|
||||
<?php
|
||||
$fp = fopen('php://input', 'r+');
|
||||
var_dump(fseek($fp, -1, SEEK_SET));
|
||||
var_dump(fseek($fp, -32, SEEK_CUR));
|
||||
fclose($fp);
|
||||
?>
|
||||
--EXPECT--
|
||||
int(-1)
|
||||
int(-1)
|
||||
|
|
@ -118,7 +118,7 @@ int(2)
|
|||
bool(false)
|
||||
===S:-10,C===
|
||||
int(-1)
|
||||
bool(false)
|
||||
int(2)
|
||||
bool(false)
|
||||
===S:3,S===
|
||||
int(0)
|
||||
|
|
|
@ -1390,6 +1390,10 @@ PHPAPI int _php_stream_seek(php_stream *stream, zend_off_t offset, int whence)
|
|||
}
|
||||
whence = SEEK_SET;
|
||||
break;
|
||||
case SEEK_SET:
|
||||
if (offset < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
ret = stream->ops->seek(stream, offset, whence, &stream->position);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue