xref: /PHP-5.3/ext/dba/tests/dba_db4_007.phpt (revision 7b329d5a)
1--TEST--
2DBA DB4 File Creation popen("c") with existing invalid file
3--SKIPIF--
4<?php
5$handler = "db4";
6require_once(dirname(__FILE__) .'/skipif.inc');
7die("info $HND handler used");
8?>
9--FILE--
10<?php
11
12$handler = "db4";
13require_once(dirname(__FILE__) .'/test.inc');
14echo "database handler: $handler\n";
15
16var_dump(file_put_contents($db_filename, "Dummy contents"));
17
18if (($db_file = dba_popen($db_filename, "c", $handler)) !== FALSE) {
19    if (file_exists($db_filename)) {
20        echo "database file created\n";
21        dba_close($db_file);
22    } else {
23        echo "File did not get created\n";
24    }
25} else {
26    echo "Error creating $db_filename\n";
27}
28
29?>
30--CLEAN--
31<?php
32require(dirname(__FILE__) .'/clean.inc');
33?>
34--EXPECTF--
35database handler: db4
36int(14)
37
38Notice: dba_popen(): %stest0.dbm: unexpected file type or format in %sdba_db4_007.php on line %d
39
40Warning: dba_popen(%stest0.dbm,c): Driver initialization failed for handler: db4: Invalid argument in %sdba_db4_007.php on line %d
41Error creating %stest0.dbm
42