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

From: Date: Sat, 26 Sep 2026 21:50:56 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141595@lists.php.net to get a copy of this message
Author: Calvin Buckley (NattyNarwhal) Date: 2026-09-26T18:50:42-03:00 Commit: https://github.com/php/php-src/commit/3a486dd67ba7066a0df0ca13ab7beccb428afdc2 Raw diff: https://github.com/php/php-src/commit/3a486dd67ba7066a0df0ca13ab7beccb428afdc2.diff Merge branch 'PHP-8.6' * PHP-8.6: ext/odbc: fix cond for SQL_NO_TOTAL that led to single byte buffer (#23462) Changed paths: A ext/pdo_odbc/tests/gh23443.phpt M ext/pdo_odbc/odbc_stmt.c Diff: diff --git a/ext/pdo_odbc/odbc_stmt.c b/ext/pdo_odbc/odbc_stmt.c index 8dd645271dbb..3c4f3acacffe 100644 --- a/ext/pdo_odbc/odbc_stmt.c +++ b/ext/pdo_odbc/odbc_stmt.c @@ -774,10 +774,14 @@ static int odbc_stmt_get_col(pdo_stmt_t *stmt, int colno, zval *result, enum pdo * changed from 256 byte to LONG_COLUMN_BUFFER_SIZE. */ ssize_t to_fetch_len; - if (orig_fetched_len == SQL_NO_TOTAL) { - to_fetch_len = C->datalen > (LONG_COLUMN_BUFFER_SIZE - 1) ? (LONG_COLUMN_BUFFER_SIZE - 1) : C->datalen; - } else { + if (orig_fetched_len == SQL_NO_TOTAL && C->datalen > (LONG_COLUMN_BUFFER_SIZE - 1)) { + to_fetch_len = C->datalen; + } else if (orig_fetched_len > 0) { + /* implicitly not SQL_NO_TOTAL, should be OK */ to_fetch_len = orig_fetched_len; + } else { + /* size must be > 0 to actually get data */ + to_fetch_len = (LONG_COLUMN_BUFFER_SIZE - 1); } ssize_t to_fetch_byte = to_fetch_len + 1; char *buf2 = emalloc(to_fetch_byte); diff --git a/ext/pdo_odbc/tests/gh23443.phpt b/ext/pdo_odbc/tests/gh23443.phpt new file mode 100644 index 000000000000..00505868760d --- /dev/null +++ b/ext/pdo_odbc/tests/gh23443.phpt @@ -0,0 +1,24 @@ +--TEST-- +GH-23443 (infinite loop / 100% CPU when fetching a large nvarchar(max)) +--EXTENSIONS-- +pdo_odbc +--SKIPIF-- +<?php +require 'ext/pdo/tests/pdo_test.inc'; +PDOTest::skip(); +?> +--FILE-- +<?php +require 'ext/pdo/tests/pdo_test.inc'; +$db = PDOTest::test_factory('ext/pdo_odbc/tests/common.phpt'); + +/* + * Likely depends on ZendMM page size + string overhead that affects long + * column buffer size + */ +$n = 4499; +$row = $db->query("SELECT REPLICATE(CAST(N'A' AS nvarchar(max)), $n) AS v")->fetch(PDO::FETCH_ASSOC); +echo "ok\n"; +?> +--EXPECT-- +ok

« previous php.cvs (#141595) next »