Merge branch 'PHP-8.3' into PHP-8.4

This commit is contained in:
David Carlier 2025-04-02 12:36:08 +01:00
commit dc93f28381
No known key found for this signature in database
GPG key ID: 2FB76A8CE6CD2B41
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);