[php-src] master: Merge branch 'PHP-8.6'

From: Date: Sun, 22 Nov 2026 09:13:02 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144020@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-22T16:21:34+08:00 Commit: https://github.com/php/php-src/commit/7e82120249b8a92d9188797251fe3ec2806c36e7 Raw diff: https://github.com/php/php-src/commit/7e82120249b8a92d9188797251fe3ec2806c36e7.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix GH-24640: Reject "#" in tcadb paths (#24656) Changed paths: A ext/dba/tests/gh24640.phpt M ext/dba/dba_tcadb.c Diff: diff --git a/ext/dba/dba_tcadb.c b/ext/dba/dba_tcadb.c index 5f4ed5eeabdc..7482d92378b5 100644 --- a/ext/dba/dba_tcadb.c +++ b/ext/dba/dba_tcadb.c @@ -32,7 +32,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 (#144020) next »