1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

This commit is contained in:
David Carlier
2025-04-02 12:36:08 +01:00
3 changed files with 18 additions and 1 deletions

View 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)

View File

@@ -118,7 +118,7 @@ int(2)
bool(false)
===S:-10,C===
int(-1)
bool(false)
int(2)
bool(false)
===S:3,S===
int(0)

View File

@@ -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);