#define PSPELL_FETCH_CONFIG do { \
zval *res = zend_hash_index_find(&EG(regular_list), conf); \
if (res == NULL || Z_RES_P(res)->type != le_pspell_config) { \
- php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " is not a PSPELL config index", conf); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "%s(): " ZEND_LONG_FMT " is not a PSPELL config index", get_active_function_name(), conf); \
+ RETURN_THROWS(); \
} \
config = (PspellConfig *)Z_RES_P(res)->ptr; \
} while (0)
#define PSPELL_FETCH_MANAGER do { \
zval *res = zend_hash_index_find(&EG(regular_list), scin); \
if (res == NULL || Z_RES_P(res)->type != le_pspell) { \
- php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " is not a PSPELL result index", scin); \
- RETURN_FALSE; \
+ zend_throw_error(NULL, "%s(): " ZEND_LONG_FMT " is not a PSPELL result index", get_active_function_name(), scin); \
+ RETURN_THROWS(); \
} \
manager = (PspellManager *)Z_RES_P(res)->ptr; \
} while (0);
var_dump(pspell_check($p, 'yy'));
$p2 = pspell_new_config($cfg2);
-var_dump(pspell_check($p2, 'yy'));
+try {
+ pspell_check($p2, 'yy');
+} catch (Error $exception) {
+ echo $exception->getMessage() . "\n";
+}
echo "---\n";
var_dump(pspell_config_ignore($cfg, 2));
bool(false)
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
-
-Warning: pspell_check(): 0 is not a PSPELL result index in %s003.php on line 10
-bool(false)
+pspell_check(): 0 is not a PSPELL result index
---
bool(true)
bool(true)