diff options
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/enchant/enchant.c | 5 | ||||
-rw-r--r-- | ext/enchant/tests/bug53070.phpt | 20 |
3 files changed, 27 insertions, 0 deletions
@@ -11,6 +11,8 @@ PHP NEWS function). (Laruence) - Enchant: + . Fixed bug #53070 (enchant_broker_get_path crashes if no path is set). (jelle + van der Waa, cmb) . Fixed bug #75365 (Enchant still reports version 1.1.0). (cmb) - Exif: diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 88993b3014..cd376a1aeb 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -482,6 +482,11 @@ PHP_FUNCTION(enchant_broker_get_dict_path) RETURN_FALSE; } + if (value == NULL) { + php_error_docref(NULL, E_WARNING, "dict_path not set"); + RETURN_FALSE; + } + RETURN_STRING(value); } /* }}} */ diff --git a/ext/enchant/tests/bug53070.phpt b/ext/enchant/tests/bug53070.phpt new file mode 100644 index 0000000000..2183960716 --- /dev/null +++ b/ext/enchant/tests/bug53070.phpt @@ -0,0 +1,20 @@ +--TEST-- +Bug #53070 (enchant_broker_get_path crashes if no path is set) +--SKIPIF-- +<?php +if(!extension_loaded('enchant')) die('skip, enchant not loader'); +if (!is_resource(enchant_broker_init())) {die("skip, resource dont load\n");} +?> +--FILE-- +<?php +$broker = enchant_broker_init(); +var_dump(enchant_broker_get_dict_path($broker, ENCHANT_MYSPELL)); +var_dump(enchant_broker_get_dict_path($broker, ENCHANT_ISPELL)); +?> +--EXPECTF-- + +Warning: enchant_broker_get_dict_path(): dict_path not set in %s on line %d +bool(false) + +Warning: enchant_broker_get_dict_path(): dict_path not set in %s on line %d +bool(false) |