Commit e66232191f9 for php

commit e66232191f9271acbd47ef93651e04a1fb7df5dd
Author: lazerg <lazerg2@gmail.com>
Date:   Sat Oct 24 21:14:38 2026 +0500

    Fix GH-24640: Reject "#" in tcadb paths (#24656)

    Tokyo Cabinet treats text after "#" as tuning parameters. That means
    tcadb could open a different file from the one PHP uses for locking.
    Reject paths containing "#" before initializing the tcadb handle,
    because Tokyo Cabinet provides no way to escape the character.

    Closes #24656

diff --git a/NEWS b/NEWS
index f8f4bd9e633..f90e69fa164 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,8 @@ PHP                                                                        NEWS
 - DBA:
   . Fixed dba_close() not closing a database opened with dba_popen().
     (Ilia Alshanetsky)
+  . Fixed bug GH-24640 (tcadb handler allows injecting Tokyo Cabinet
+    parameters via "#" in the path). (Lazizbek Ergashev)

 - DOM:
   . Fixed bug GH-25268 (NULL php_libxml_ref_obj dereference in
diff --git a/ext/dba/dba_tcadb.c b/ext/dba/dba_tcadb.c
index 6f4cb01e69e..201fc73a2ad 100644
--- a/ext/dba/dba_tcadb.c
+++ b/ext/dba/dba_tcadb.c
@@ -34,7 +34,14 @@ typedef struct {
 DBA_OPEN_FUNC(tcadb)
 {
 	char *path_string;
-	TCADB *tcadb = tcadbnew();
+	TCADB *tcadb;
+
+	if (memchr(ZSTR_VAL(info->path), '#', ZSTR_LEN(info->path))) {
+		*error = "Path must not contain \"#\"";
+		return FAILURE;
+	}
+
+	tcadb = tcadbnew();

 	if (tcadb) {
 		switch(info->mode) {
diff --git a/ext/dba/tests/gh24640.phpt b/ext/dba/tests/gh24640.phpt
new file mode 100644
index 00000000000..6a7fce3d0c9
--- /dev/null
+++ b/ext/dba/tests/gh24640.phpt
@@ -0,0 +1,24 @@
+--TEST--
+GH-24640 (tcadb handler allows injecting Tokyo Cabinet parameters via "#" in the path)
+--EXTENSIONS--
+dba
+--SKIPIF--
+<?php
+require_once __DIR__ . '/setup/setup_dba_tests.inc';
+check_skip('tcadb');
+?>
+--FILE--
+<?php
+$db_file = __DIR__ . '/gh24640.tch';
+
+var_dump(dba_open($db_file . '#bnum=1000', 'n-', 'tcadb'));
+var_dump(file_exists($db_file));
+?>
+--CLEAN--
+<?php
+@unlink(__DIR__ . '/gh24640.tch');
+?>
+--EXPECTF--
+Warning: dba_open(): Driver initialization failed for handler: tcadb: Path must not contain "#" in %s on line %d
+bool(false)
+bool(false)