diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2017-10-15 14:03:24 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2017-10-15 14:07:41 +0200 |
commit | 46d87c1f104261331a3fa33208f2da4d92c59225 (patch) | |
tree | 395bfde0d89697db513fd0b1e328962558988c4c | |
parent | de5f15ed4e20c48a98e17566b60979cdc355e820 (diff) | |
parent | 5e2751e7ffa5ad877083abc7dda8da658c9691c7 (diff) | |
download | php-git-46d87c1f104261331a3fa33208f2da4d92c59225.tar.gz |
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
Fixed bug #53070 (enchant_broker_get_path crashes if no path is set)
-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 10e3572eb1..25edf66a74 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) |