Skip to content

Stdlib: ext/sqlsrv — sqlsrv_connect()/sqlsrv_query() SQL Server driver (#6577) - #35597

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-6577-sqlsrv
Aug 28, 2026
Merged

Stdlib: ext/sqlsrv — sqlsrv_connect()/sqlsrv_query() SQL Server driver (#6577)#35597
PurHur merged 1 commit into
masterfrom
agent/issue-6577-sqlsrv

Conversation

@PurHur

@PurHur PurHur commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add ext/sqlsrv/ with phase-1 procedural builtins: sqlsrv_connect, sqlsrv_close, sqlsrv_query, sqlsrv_fetch_array, sqlsrv_errors.
  • function_exists('sqlsrv_*') is true; invalid connect returns false and populates structured sqlsrv_errors() (IMSSP/-49) when the Microsoft ODBC driver is absent — matches php-src ext/sqlsrv enterprise probe pattern.
  • Register module in ExtensionRegistry (83 extensions) and capability matrix (+5 builtins → 1172).

php-src reference

  • ext/sqlsrv/php_sqlsrv.c — module init / function registration
  • ext/sqlsrv/shared/core_conn.cpp — connect + error propagation

Verification

./script/aot-smoke.sh
# aot-smoke: 8 passed, 0 failed

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
foreach ([\"sqlsrv_connect\",\"sqlsrv_query\",\"sqlsrv_fetch_array\",\"sqlsrv_errors\",\"sqlsrv_close\"] as \$fn) {
    echo \$fn, \"=\", var_export(function_exists(\$fn), true), \"\\n\";
}
\$conn = sqlsrv_connect(\"localhost\", [\"Database\" => \"test\", \"UID\" => \"sa\", \"PWD\" => \"x\"]);
echo \"connect=\", var_export(\$conn, true), \"\\n\";
\$errors = sqlsrv_errors();
echo \"sqlstate=\", \$errors[0][\"SQLSTATE\"], \" code=\", \$errors[0][\"code\"], \"\\n\";
"'
# sqlsrv_connect=true … sqlsrv_close=true
# connect=false
# sqlstate=IMSSP code=-49

php script/generate-extension-registry.php --check
# ok — 83 extensions

php script/capability-matrix.php --check
# ok (after regen committed)

Note: VMTest data provider currently errors on an unrelated PHPT EXTENSIONS section on master; repro verified via bin/vm.php inline above and committed test/compliance/cases/stdlib/sqlsrv_functions_exist.phpt.

Closes #6577

Made with Cursor

Add phase-1 sqlsrv module so function_exists probes succeed and invalid
connect returns false with structured sqlsrv_errors() when the Microsoft
ODBC driver is absent (php-src ext/sqlsrv).

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 12a4e6e into master Aug 28, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-6577-sqlsrv branch August 28, 2026 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: ext/sqlsrv — sqlsrv_connect()/sqlsrv_query() SQL Server driver missing (ext/sqlsrv)

1 participant