Browse Source

Fixed bug #53070 (enchant_broker_get_path crashes if no path is set)

enchant_broker_get_dict_path segfaults when the dict path is not setup,
instead of segfaulting return false instead.
pull/2867/head
Jelle van der Waa 9 years ago
committed by Christoph M. Becker
parent
commit
5acb8381b2
  1. 2
      NEWS
  2. 5
      ext/enchant/enchant.c
  3. 20
      ext/enchant/tests/bug53070.phpt

2
NEWS

@ -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:

5
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);
}
/* }}} */

20
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)
Loading…
Cancel
Save