Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ext/pspell/pspell.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ static void php_pspell_close_config(zend_resource *rsrc)
#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);
Expand Down
10 changes: 6 additions & 4 deletions ext/pspell/tests/003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ $p = pspell_new_config($cfg);
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));
Expand All @@ -30,9 +34,7 @@ var_dump(pspell_config_ignore($cfg, PHP_INT_MAX));
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)
Expand Down