Comment 0 for bug 1990302

Revision history for this message
Martin Kucej (mkucej) wrote :

Ubuntu 22.04 default PHP package (2:8.1+92ubuntu1) contains the pre-8.1.6 bug:

https://www.php.net/ChangeLog-8.php#8.1.6

Streams:

    Fixed php://temp does not preserve file-position when switched to temporary file.

Fixed in:

https://github.com/php/php-src/commit/84c18f9f04cb9852d992194e613927154f765192

Current workaround:

When opening php://temp, prevent its conversion to a file by increasing maxmemory to whatever number your application needs:

$fp = fopen("php://temp/maxmemory:5242880", 'w+');