Files
frankenphp/testdata/file-stream.php
Rob Landers 05aafc7c44 fix memory leaks (#1350)
* fix a memory leak on thread shutdown

* clean up unused resources at end of request

* try the obvious

* Test

* clang-format

* Also ignores persistent streams.

* Adds stream test.

* Moves clean up function to frankenphp_worker_request_shutdown.

* Fixes test on -nowatcher

* Fixes test on -nowatcher

* Update testdata/file-stream.txt

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

* Update frankenphp_test.go

Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>

---------

Co-authored-by: Alliballibaba <alliballibaba@gmail.com>
Co-authored-by: Kévin Dunglas <kevin@dunglas.fr>
2025-01-25 22:54:04 +01:00

14 lines
358 B
PHP

<?php
$fileStream = fopen(__DIR__ . '/file-stream.txt', 'r');
$input = fopen('php://input', 'r');
while (frankenphp_handle_request(function () use ($fileStream, $input) {
echo fread($fileStream, 5);
// this line will lead to a zend_mm_heap corrupted error if the input stream was destroyed
stream_is_local($input);
})) ;
fclose($fileStream);