mirror of
https://gitee.com/lionsoul/friso.git
synced 2024-11-29 17:57:38 +08:00
throw exceptions when dictionary not load success
This commit is contained in:
parent
18e0c79693
commit
01f3da3375
10
vendors/binding/php5/friso.c
vendored
10
vendors/binding/php5/friso.c
vendored
@ -4,6 +4,7 @@
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include <zend_exceptions.h>
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_friso.h"
|
||||
@ -290,6 +291,15 @@ PHP_FUNCTION(friso_split)
|
||||
task = friso_new_task();
|
||||
idx = 0;
|
||||
friso_set_text(task, _str);
|
||||
|
||||
|
||||
if (friso_globals.friso->dic == NULL) {
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C),
|
||||
"[Error] Can not load dictionry with lex_dir from friso.ini, please check the ini file", 0 TSRMLS_CC);
|
||||
|
||||
RETURN_BOOL(0);
|
||||
}
|
||||
|
||||
while ( config->next_token( friso_globals.friso, config, task ) != NULL )
|
||||
{
|
||||
MAKE_STD_ZVAL(item);
|
||||
|
4
vendors/binding/php7/friso.c
vendored
4
vendors/binding/php7/friso.c
vendored
@ -21,6 +21,7 @@
|
||||
#endif
|
||||
|
||||
#include "php.h"
|
||||
#include <zend_exceptions.h>
|
||||
#include "php_ini.h"
|
||||
#include "ext/standard/info.h"
|
||||
#include "php_friso.h"
|
||||
@ -332,6 +333,9 @@ PHP_FUNCTION(friso_split)
|
||||
|
||||
// to prevent segfault error when dic file not configure correct
|
||||
if (friso_globals.friso->dic == NULL) {
|
||||
zend_throw_exception(zend_exception_get_default(TSRMLS_C),
|
||||
"[Error] can not load dictionry with lex_dir from ini file, please check the friso.ini", 0 TSRMLS_CC);
|
||||
|
||||
RETURN_BOOL(0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user