Bug #80644 [Ver]: Missing resource causes subsequent get() calls to fail

From: Date: Tue, 19 Jan 2021 14:15:18 +0000
Subject: Bug #80644 [Ver]: Missing resource causes subsequent get() calls to fail
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231641@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80644&edit=1 ID: 80644 Updated by: nikic@php.net Reported by: rdueck at mcmillan-mcgee dot com Summary: Missing resource causes subsequent get() calls to fail Status: Verified Type: Bug Package: *Languages/Translation Operating System: Ubuntu 16.04.7 LTS PHP Version: 8.0.1 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: Okay, this is pretty subtle. The code used RESOURCEBUNDLE_METHOD_FETCH_OBJECT previously, which apparently performs an implicit reset of the error state. When the code was migrated to zend_object, that reset was lost. Previous Comments: ------------------------------------------------------------------------ [2021-01-18 22:18:24] rdueck at mcmillan-mcgee dot com Description: ------------ Upgrading from 7.4.14 to 8.0.1 changes the behaviour of ResourceBundle::get($index). If a non-existent $index is requested, get($index) returns null, and all subsequent calls to get() also return null, even for $index values that exist. Test script: --------------- <?php file_put_contents('en.txt','en { "exists" {"found"} }'); shell_exec('genrb en.txt'); $r = new ResourceBundle('en.res', __DIR__); $r->get('does_not_exist'); if($r->get('exists') === null) echo "Error\n"; else echo "Ok\n"; // cleanup unlink('en.txt'); unlink('en.res'); Expected result: ---------------- Ok Actual result: -------------- Error ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80644&edit=1

« previous php.bugs (#231641) next »