[php-src] master: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Sun, 22 Nov 2026 09:12:57 +0000
Subject: [php-src] master: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144018@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-22T16:21:03+08:00 Commit: https://github.com/php/php-src/commit/972fd251b39006fbb5000dad781eacb0772b9177 Raw diff: https://github.com/php/php-src/commit/972fd251b39006fbb5000dad781eacb0772b9177.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Fix GH-24640: Reject "#" in tcadb paths (#24656) Changed paths: A ext/dba/tests/gh24640.phpt M NEWS M ext/dba/dba_tcadb.c Diff: diff --git a/NEWS b/NEWS index f28d555fbd5f..90451f99d01e 100644 --- a/NEWS +++ b/NEWS @@ -42,6 +42,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-25306 (Assertion status == LXB_STATUS_OK in dom_parse_selector diff --git a/ext/dba/dba_tcadb.c b/ext/dba/dba_tcadb.c index 6f4cb01e69e5..201fc73a2ad2 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 000000000000..6a7fce3d0c9c --- /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)

« previous php.cvs (#144018) next »