Commit e19f7ac0d16 for php

commit e19f7ac0d16eddd659f09947f7519544c4c6fc75
Author: lacatoire <ext-lacatoire@cenef.fr>
Date:   Sun Aug 16 11:46:40 2026 +0200

    Fix Enchant dictionary path return values with libenchant 2 (#23307)

    Libenchant 2 removed the broker parameter APIs. When PHP builds against
    it, the deprecated enchant_broker_set_dict_path() and
    enchant_broker_get_dict_path() fell through and returned null.

    Return false to report the unsupported operation, as specified by both
    functions' return types. Add coverage for the libenchant 2 path.

    Closes #23307

diff --git a/NEWS b/NEWS
index 7b35ee47b1a..91c21c38d7f 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? ????, PHP 8.4.30

+- Enchant:
+  . Fixed enchant_broker_set_dict_path() and enchant_broker_get_dict_path()
+    returning null with libenchant 2. Both now return false. (lacatoire)
+
 - Standard:
   . Fixed bug GH-25959 ("consumed" stream filter loses or repeats data).
     (Artem Ukrainskiy)
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c
index bbebd8cd806..c830929d7e6 100644
--- a/ext/enchant/enchant.c
+++ b/ext/enchant/enchant.c
@@ -367,6 +367,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
 }
 /* }}} */
@@ -408,6 +413,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 00000000000..b06da5ef0d4
--- /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--
+<?php
+if (!defined("LIBENCHANT_VERSION") || version_compare(LIBENCHANT_VERSION, "2", "<")) die('skip libenchant v2 only');
+?>
+--FILE--
+<?php
+$broker = enchant_broker_init();
+var_dump(@enchant_broker_set_dict_path($broker, ENCHANT_MYSPELL, '/tmp'));
+var_dump(@enchant_broker_get_dict_path($broker, ENCHANT_MYSPELL));
+?>
+--EXPECT--
+bool(false)
+bool(false)