|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80156 Incomplete records may be written
Submitted: 2020-09-27 12:16 UTC Modified: 2020-09-27 12:49 UTC
From: Assigned: cmb (profile)
Status: Closed Package: dbase (PECL)
PHP Version: 7.4.10 OS: *
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:
New email:
PHP Version: OS:


 [2020-09-27 12:16 UTC]
As of PHP 7.4.0, __toString() methods are allowed to throw
exceptions, what is not handled properly by the dbase extension,
so that incomplete records may be written to the database.

That also affects dbase_create(), but missing to handle exceptions
here only leads to confusing warnings.

Test script:
class Foo {
    public function __toString() {
        throw new Exception("not allowed");
$def = [["name1", "c", 10], ["name2", "c", 10]];
$dbase = dbase_create(__DIR__ . "/dbase.dbf", $def);
try {
    dbase_add_record($dbase, ["cmb", new Foo]);
} catch (Exception $ex) {}

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-09-27 12:26 UTC]
-Assigned To: +Assigned To: cmb
 [2020-09-27 12:49 UTC]
-Status: Assigned +Status: Closed
 [2021-04-06 10:18 UTC]
Automatic comment on behalf of 
Log: Fix #80156: Incomplete records may be written
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 09:01:29 2024 UTC