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

From: Date: Tue, 19 Jan 2021 14:21:19 +0000
Subject: Bug #80644 [Ver->Csd]: Missing resource causes subsequent get() calls to fail
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231642@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 +Status: Closed Type: Bug Package: *Languages/Translation Operating System: Ubuntu 16.04.7 LTS PHP Version: 8.0.1 Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=05d168013a2be5e85c43f0d6c92aeab899e7952b Log: Fixed bug #80644: ResourceBundle::get() doesn't reset error state Previous Comments: ------------------------------------------------------------------------ [2021-01-19 14:15:18] nikic@php.net 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. ------------------------------------------------------------------------ [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 (#231642) next »