diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index a109c24062f0..0ca04b8b2f7f 100644 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -348,6 +348,11 @@ PHP_FUNCTION(enchant_broker_set_dict_path) default: RETURN_FALSE; } +#else + /* enchant_broker_set_param() was removed in libenchant 2, so this build has + * no dictionary path support. Report the failure instead of falling off the + * end of the function, which would return null and violate the return type. */ + RETURN_FALSE; #endif } /* }}} */ @@ -387,6 +392,9 @@ PHP_FUNCTION(enchant_broker_get_dict_path) } RETURN_STRING(value); +#else + /* See enchant_broker_set_dict_path(). */ + RETURN_FALSE; #endif } /* }}} */ diff --git a/ext/enchant/tests/dict_path_libenchant2.phpt b/ext/enchant/tests/dict_path_libenchant2.phpt new file mode 100644 index 000000000000..b06da5ef0d4e --- /dev/null +++ b/ext/enchant/tests/dict_path_libenchant2.phpt @@ -0,0 +1,17 @@ +--TEST-- +enchant_broker_set_dict_path() / enchant_broker_get_dict_path() honour their return types without libenchant 1 support +--EXTENSIONS-- +enchant +--SKIPIF-- + +--FILE-- + +--EXPECT-- +bool(false) +bool(false)