dba_db4_003.phpt 998 B

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