Commit c6e74fc1318 for php.net
commit c6e74fc13189afbc7c2a02a2af42f9ccf4dabc33
Author: NickSdot <32384907+NickSdot@users.noreply.github.com>
Date: Wed Aug 5 05:43:41 2026 +0700
ext/dba: applied fixers to improve test robustness (#23027)
diff --git a/ext/dba/tests/dba015.phpt b/ext/dba/tests/dba015.phpt
index a2fa60eb602..b8979f962df 100644
--- a/ext/dba/tests/dba015.phpt
+++ b/ext/dba/tests/dba015.phpt
@@ -48,7 +48,7 @@
try {
dba_exists("key1", $db_file2);
} catch (Error $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
echo "Test 6 - query after closing 2nd object\n";
@@ -75,7 +75,7 @@
Test 5 - close 2nd object
object(Dba\Connection)#%d (%d) {
}
-DBA connection has already been closed
+Error: DBA connection has already been closed
Test 6 - query after closing 2nd object
This is a test insert 1
This is a test insert 2
diff --git a/ext/dba/tests/dba_array_keys_errors.phpt b/ext/dba/tests/dba_array_keys_errors.phpt
index d80915c7c31..e9544c8d717 100644
--- a/ext/dba/tests/dba_array_keys_errors.phpt
+++ b/ext/dba/tests/dba_array_keys_errors.phpt
@@ -17,12 +17,12 @@
try {
dba_insert([], "Content String 1", $db);
} catch (\Error $e) {
- echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
dba_insert(["a", "b", "c"], "Content String 2", $db);
} catch (\Error $e) {
- echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
/* Use an object */
@@ -30,12 +30,12 @@
try {
var_dump(dba_insert([$o, 'obj'], 'Test', $db));
} catch (\Error $e) {
- echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_insert(['group', $o], 'Test', $db));
} catch (\Error $e) {
- echo $e::class, ': ', $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
dba_close($db);
diff --git a/ext/dba/tests/dba_fetch_legacy_signature.phpt b/ext/dba/tests/dba_fetch_legacy_signature.phpt
index 40933f4c76b..be5f78dd032 100644
--- a/ext/dba/tests/dba_fetch_legacy_signature.phpt
+++ b/ext/dba/tests/dba_fetch_legacy_signature.phpt
@@ -24,7 +24,7 @@
try {
dba_fetch("key1", 0, $db);
} catch (Exception $e) {
- echo $e->getMessage() . "\n";
+ echo $e::class, ': ', $e->getMessage(), "\n";
}
dba_close($db);
@@ -41,4 +41,4 @@
Deprecated: Calling dba_fetch() with $dba at the 3rd parameter is deprecated in %s on line %d
This is a test insert
This is a test insert
-Calling dba_fetch() with $dba at the 3rd parameter is deprecated
+Exception: Calling dba_fetch() with $dba at the 3rd parameter is deprecated
diff --git a/ext/dba/tests/dba_flags_arg.phpt b/ext/dba/tests/dba_flags_arg.phpt
index 6a387b51822..6815f3dec21 100644
--- a/ext/dba/tests/dba_flags_arg.phpt
+++ b/ext/dba/tests/dba_flags_arg.phpt
@@ -7,8 +7,8 @@
try {
dba_open('irrelevant', 'c', 'handler', flags: -1);
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--EXPECT--
-dba_open(): Argument #6 ($flags) must be greater than or equal to 0
+ValueError: dba_open(): Argument #6 ($flags) must be greater than or equal to 0
diff --git a/ext/dba/tests/gh19885.phpt b/ext/dba/tests/gh19885.phpt
index 987aea4f175..e6358b3c59b 100644
--- a/ext/dba/tests/gh19885.phpt
+++ b/ext/dba/tests/gh19885.phpt
@@ -16,20 +16,20 @@
try {
dba_fetch("1", $db, PHP_INT_MIN);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
dba_fetch("1", $db, PHP_INT_MAX);
} catch (\ValueError $e) {
- echo $e->getMessage(), PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
// negative skip needs to remain acceptable albeit corrected down the line
var_dump(dba_fetch("1", $db, -1000000));
?>
--EXPECTF--
-dba_fetch(): Argument #3 ($skip) must be between -%d and %d
-dba_fetch(): Argument #3 ($skip) must be between -%d and %d
+ValueError: dba_fetch(): Argument #3 ($skip) must be between -%d and %d
+ValueError: dba_fetch(): Argument #3 ($skip) must be between -%d and %d
Notice: dba_fetch(): Handler cdb accepts only skip values greater than or equal to zero, using skip=0 in %s on line %d
string(1) "1"
diff --git a/ext/dba/tests/value_errors_open.phpt b/ext/dba/tests/value_errors_open.phpt
index ee995fe5b8d..b5472a23d69 100644
--- a/ext/dba/tests/value_errors_open.phpt
+++ b/ext/dba/tests/value_errors_open.phpt
@@ -21,45 +21,45 @@
try {
var_dump(dba_open('', 'nq'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_open($db_file, ''));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'nq', ''));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'q'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'nq'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'rdq'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'n-t'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_open($db_file, 'r', $handler, 0o644, -10));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
echo '=== Invalid arguments dba_popen() ===', \PHP_EOL;
@@ -68,45 +68,45 @@
try {
var_dump(dba_popen('', 'nq'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_popen($db_file, ''));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'nq', ''));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'q'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'nq'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'rdq'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'n-t'));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
var_dump(dba_popen($db_file, 'r', $handler, 0o644, -10));
} catch (\ValueError $e) {
- echo $e->getMessage(), \PHP_EOL;
+ echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--CLEAN--
@@ -121,23 +121,23 @@
Warning: dba_open(): Handler "bogus" is not available in %s on line %d
bool(false)
-dba_open(): Argument #1 ($path) must not be empty
-dba_open(): Argument #2 ($mode) must not be empty
-dba_open(): Argument #3 ($handler) must not be empty
-dba_open(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n"
-dba_open(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t"
-dba_open(): Argument #2 ($mode) third character must be "t"
-dba_open(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock)
-dba_open(): Argument #5 ($map_size) must be greater than or equal to 0
+ValueError: dba_open(): Argument #1 ($path) must not be empty
+ValueError: dba_open(): Argument #2 ($mode) must not be empty
+ValueError: dba_open(): Argument #3 ($handler) must not be empty
+ValueError: dba_open(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n"
+ValueError: dba_open(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t"
+ValueError: dba_open(): Argument #2 ($mode) third character must be "t"
+ValueError: dba_open(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock)
+ValueError: dba_open(): Argument #5 ($map_size) must be greater than or equal to 0
=== Invalid arguments dba_popen() ===
Warning: dba_popen(): Handler "bogus" is not available in %s on line %d
bool(false)
-dba_popen(): Argument #1 ($path) must not be empty
-dba_popen(): Argument #2 ($mode) must not be empty
-dba_popen(): Argument #3 ($handler) must not be empty
-dba_popen(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n"
-dba_popen(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t"
-dba_popen(): Argument #2 ($mode) third character must be "t"
-dba_popen(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock)
-dba_popen(): Argument #5 ($map_size) must be greater than or equal to 0
+ValueError: dba_popen(): Argument #1 ($path) must not be empty
+ValueError: dba_popen(): Argument #2 ($mode) must not be empty
+ValueError: dba_popen(): Argument #3 ($handler) must not be empty
+ValueError: dba_popen(): Argument #2 ($mode) first character must be one of "r", "w", "c", or "n"
+ValueError: dba_popen(): Argument #2 ($mode) second character must be one of "d", "l", "-", or "t"
+ValueError: dba_popen(): Argument #2 ($mode) third character must be "t"
+ValueError: dba_popen(): Argument #2 ($mode) cannot combine mode "-" (no lock) and "t" (test lock)
+ValueError: dba_popen(): Argument #5 ($map_size) must be greater than or equal to 0