003.phpt 1023 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. pspell_config_ignore
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded('pspell')) die('skip');
  6. if (!@pspell_new('en')) die('skip English dictionary is not available');
  7. ?>
  8. --FILE--
  9. <?php
  10. $cfg = pspell_config_create('en', 'british', '', 'iso8859-1');
  11. $cfg2 = pspell_config_create('en', 'british', '', 'b0rked');
  12. $p = pspell_new_config($cfg);
  13. var_dump(pspell_check($p, 'yy'));
  14. $p2 = pspell_new_config($cfg2);
  15. var_dump(pspell_check($p2, 'yy'));
  16. echo "---\n";
  17. var_dump(pspell_config_ignore($cfg, 2));
  18. $p = pspell_new_config($cfg);
  19. var_dump(pspell_check($p, 'yy'));
  20. // segfault it?
  21. var_dump(pspell_config_ignore($cfg, PHP_INT_MAX));
  22. ?>
  23. --EXPECTF--
  24. bool(false)
  25. Warning: pspell_new_config(): PSPELL couldn't open the dictionary. reason: The encoding "b0rked" is not known. This could also mean that the file "%sb0rked.%s" could not be opened for reading or does not exist. in %s003.php on line 9
  26. Warning: pspell_check(): 0 is not a PSPELL result index in %s003.php on line 10
  27. bool(false)
  28. ---
  29. bool(true)
  30. bool(true)
  31. bool(true)