dba_db4_003.phpt 1009 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. --TEST--
  2. DBA DB4 File Creation open("c") with existing file
  3. --SKIPIF--
  4. <?php
  5. $handler = "db4";
  6. require_once(dirname(__FILE__) .'/skipif.inc');
  7. die("info $HND handler used");
  8. ?>
  9. --FILE--
  10. <?php
  11. $handler = "db4";
  12. require_once(dirname(__FILE__) .'/test.inc');
  13. echo "database handler: $handler\n";
  14. var_dump(file_put_contents($db_filename, "Dummy contents"));
  15. if (($db_file = dba_open($db_filename, "c", $handler)) !== FALSE) {
  16. if (file_exists($db_filename)) {
  17. echo "database file created\n";
  18. dba_close($db_file);
  19. } else {
  20. echo "File did not get created\n";
  21. }
  22. } else {
  23. echo "Error creating $db_filename\n";
  24. }
  25. // Check the file still exists
  26. $s = file_get_contents($db_filename);
  27. echo "$s\n";
  28. ?>
  29. --CLEAN--
  30. <?php
  31. require(dirname(__FILE__) .'/clean.inc');
  32. ?>
  33. --EXPECTF--
  34. database handler: db4
  35. int(14)
  36. Warning: dba_open(%stest0.dbm,c): Driver initialization failed for handler: db4: Invalid argument in %sdba_db4_003.php on line %d
  37. Error creating %stest0.dbm
  38. Dummy contents