|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-27 12:26 UTC] cmb@php.net
-Assigned To:
+Assigned To: cmb
[2020-09-27 12:49 UTC] cmb@php.net
-Status: Assigned
+Status: Closed
[2020-09-27 12:49 UTC] cmb@php.net
[2021-04-06 10:18 UTC] git@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 10:00:02 2025 UTC |
Description: ------------ 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: --------------- <?php 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) {} var_dump(dbase_numrecords($dbase)); ?> Expected result: ---------------- int(0) Actual result: -------------- int(1)