|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80644 Missing resource causes subsequent get() calls to fail
Submitted: 2021-01-18 22:18 UTC Modified: 2021-01-19 14:15 UTC
From: rdueck at mcmillan-mcgee dot com Assigned: nikic (profile)
Status: Closed Package: *Languages/Translation
PHP Version: 8.0.1 OS: Ubuntu 16.04.7 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: rdueck at mcmillan-mcgee dot com
New email:
PHP Version: OS:


 [2021-01-18 22:18 UTC] rdueck at mcmillan-mcgee dot com
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:
file_put_contents('en.txt','en { "exists" {"found"} }');
shell_exec('genrb en.txt');
$r = new ResourceBundle('en.res', __DIR__);
if($r->get('exists') === null) echo "Error\n";
else echo "Ok\n";
// cleanup

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-19 13:51 UTC]
-Status: Open +Status: Verified
 [2021-01-19 14:15 UTC]
-Assigned To: +Assigned To: nikic
 [2021-01-19 14:15 UTC]
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-19 14:21 UTC]
Automatic comment on behalf of
Log: Fixed bug #80644: ResourceBundle::get() doesn't reset error state
 [2021-01-19 14:21 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Mar 03 10:01:29 2024 UTC