mirror of
https://github.com/pestphp/pest.git
synced 2026-12-05 07:15:33 +01:00
fix(tia): stop ReadCapture from keeping a wrapper per filesystem call (#2057)
* fix(tia): free the ReadCapture wrapper each time it steps aside stream_wrapper_restore() takes a user wrapper out of the wrapper table but does not free it, so every filesystem call made while a test records kept one until the process ended. Unregistering it first frees it. * fix(tia): skip the unregister when file:// is already gone A test can unregister file:// itself. stream_wrapper_unregister() then warns, where stream_wrapper_restore() alone did not, so check first. Also run the per-test memory check over 5,000 tests and update the snapshot and parallel totals for the new tests. * Use fopen() in the memory regression test --------- Co-authored-by: Mohannad Elemary <20709195+MohannadElemary@users.noreply.github.com>
This commit is contained in:
@@ -89,13 +89,16 @@ final class ReadCapture
|
||||
|
||||
private static function disable(): void
|
||||
{
|
||||
if (in_array(self::PROTOCOL, stream_get_wrappers(), true)) {
|
||||
stream_wrapper_unregister(self::PROTOCOL);
|
||||
}
|
||||
|
||||
if (self::$previousWrapper === null) {
|
||||
stream_wrapper_restore(self::PROTOCOL);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
stream_wrapper_unregister(self::PROTOCOL);
|
||||
stream_wrapper_register(self::PROTOCOL, self::$previousWrapper);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user