[php-src] Issue #8113: Php crashing with a TypeError even when declare(strict_types=1) is not set, or even set to strict_types=0

From: Date: Fri, 18 Feb 2022 10:26:44 +0000
Subject: [php-src] Issue #8113: Php crashing with a TypeError even when declare(strict_types=1) is not set, or even set to strict_types=0
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-239871@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8113 Comment Author: cmb69 > Uncaught TypeError You *can* catch that, but according to "best practise" you *should* never attempt to catch Errors. If there is any change that the resource has been closed, better check that up-front (e.g. with is_resource()). And while I think a TypeError is not quite right (it should be a ValueError instead), that is intrinsic to *all* resource types (not only socket/stream resources), but these are considered legacy types anyway, and will likely be replaced by objects in future PHP releases. The only problem I see is that such is_resource() checks makes switching to objects a more serious BC break. So, the behavior is not a bug, but we should think about some way to provide userland code with a forward compatible way to check for closed resources.

« previous php.bugs (#239871) next »