Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ext/dba/tests/dba015.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var_dump($db_file1);
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";
Expand All @@ -75,7 +75,7 @@ This is a test insert 2
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
8 changes: 4 additions & 4 deletions ext/dba/tests/dba_array_keys_errors.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ $db = get_any_db($name);
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 */
$o = new stdClass();
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);
Expand Down
4 changes: 2 additions & 2 deletions ext/dba/tests/dba_fetch_legacy_signature.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ set_error_handler(function ($severity, $message, $file, $line) {
try {
dba_fetch("key1", 0, $db);
} catch (Exception $e) {
echo $e->getMessage() . "\n";
echo $e::class, ': ', $e->getMessage(), "\n";
}
dba_close($db);

Expand All @@ -41,4 +41,4 @@ Using handler: "%s"
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
4 changes: 2 additions & 2 deletions ext/dba/tests/dba_flags_arg.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ dba
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
8 changes: 4 additions & 4 deletions ext/dba/tests/gh19885.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ $db =dba_open($db_file, "r", $handler);
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"
64 changes: 32 additions & 32 deletions ext/dba/tests/value_errors_open.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,45 @@ var_dump(dba_open($db_file, 'n', 'bogus'));
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;
Expand All @@ -68,45 +68,45 @@ var_dump(dba_popen($db_file, 'n', 'bogus'));
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--
Expand All @@ -121,23 +121,23 @@ object(Dba\Connection)#%d (%d) {

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
Loading