Comment 1 for bug 1990302

Revision history for this message
Athos Ribeiro (athos-ribeiro) wrote :

Thanks for taking the time to report this bug.

This is a minimal reproducer, available in the linked upstream patch:

<?php

$f = fopen('php://temp/maxmemory:1024', 'r+');
fwrite($f, str_repeat("1", 738));
fseek($f, 0, SEEK_SET);
fwrite($f, str_repeat("2", 512));

fseek($f, 0, SEEK_SET);
var_dump(fread($f, 16));

fseek($f, 0, SEEK_END);
var_dump(ftell($f));

?>

Buggy (jammy):
$ php reproduce.php
string(16) "1111111111111111"
int(1250)

Fixed (kinetic):
$ php reproduce.php
string(16) "2222222222222222"
int(738)

As one can see, the file position is indeed not being preserved in the affected run (jammy).