php / php/php-src

ext/pdo_odbc: infinite loop / 100% CPU when fetching a large nvarchar(max) via MS ODBC Driver 18 — SQLGetData is called with a 1-byte buffer and the loop never makes progress (distinct from GH-21534)

Open
#23,443 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Status: Needs Triage
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

pdo_odbc_issue.md

[ODBC][45576][...][SQLGetData.c][237]
Entry:
Statement = 0x909c88000
Column Number = 1
Target Type = 1 SQL_CHAR
Buffer Length = 1
Target Value = 0x106bfb860
StrLen Or Ind = 0x10741a850
[ODBC][45576][...][SQLGetData.c][545]
Exit:[SQL_SUCCESS_WITH_INFO]
Buffer = Indicator = -4
Strlen Or Ind = 0x10741a850 -> -4 (64 bits)

PHP Version
PHP 8.5.8 (cli) (built: Jul  1 2026 03:46:27) (NTS)
Copyright (c) The PHP Group
Built by Homebrew
Zend Engine v4.5.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.8, Copyright (c), by Zend Technologies
Operating System

macOS 26.5.2 (build 25F84), Apple Silicon / arm64 (Darwin 25.5.0)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the attached pdo_odbc_issue.md and the ext/pdo_odbc implementation around SQLGetData calls. Reproduce the large nvarchar(max) fetch with MS ODBC Driver 18 and inspect why the 1-byte buffer returns SQL_SUCCESS_WITH_INFO without progress. Done means the fetch completes without an infinite loop or sustained 100% CPU.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.