Spot the bug in import cleanup

from Exceptions
PHP 8.3.33 intermediate 4 min 2 issues to find

Find why the TypeError escapes the handler and why cleanup is not guaranteed.

php
<?php
function importRow(array $row): void
{
    $stream = fopen('php://temp', 'w+');
    try {
        strlen($row);
    } catch (Exception $error) {
        echo "invalid row\n";
    }
    fwrite($stream, 'done');
    fclose($stream);
}
Open in playground
Report an error