Announcing Microsoft Drivers 5.13.1 for PHP for SQL Server
We have released Microsoft Drivers 5.13.1 for PHP for SQL Server (sqlsrv and pdo_sqlsrv). This patch release addresses several important bug fixes, including a security fix for access token handling in pooled connections and multiple stability improvements.
Bug Fixes
Access token identity leaking across pooled connections
When using access token authentication with connection pooling, connections with different tokens could share the same pool entry, causing identity cross-contamination and use-after-free. This release properly incorporates the access token into the connection pool key, ensuring connections are only reused when the token matches. (#1592, fixes #1396)
Prepared statement silently failing on insert
A prepared INSERT statement could silently fail when triggers or SET NOCOUNT OFF produce extra result sets, causing an implicit transaction rollback with MARS enabled. The driver now correctly handles this scenario. (#1590)
Fatal error re-executing prepared statements with varying result sets
Re-executing a prepared statement that returns multiple result sets with different column layouts could cause a fatal error. Metadata entries are now properly freed, and the internal vector is cleared between executions. (#1596)
sqlsrv_errors() returning null after failed connection
When a connection attempt failed and ODBC provided no diagnostic records, sqlsrv_errors() would return null instead of surfacing the error. Connection failures now consistently report the underlying error. (#1595)
Stream becoming invalid when statement goes out of scope
A binary stream could become invalid when the originating statement went out of scope, leading to undefined behavior or crashes. The driver now properly invalidates streams when their parent statement is destroyed. (#1598, fixes #1443)
Installation
PECL (Linux/macOS)
sudo pecl install sqlsrv sudo pecl install pdo_sqlsrv
Windows
Download the prebuilt binaries from the GitHub Releases page and follow the loading instructions.
Prerequisites
- ODBC Driver: Microsoft ODBC Driver 17 or 18 for SQL Server
- PHP: 8.3, 8.4, or 8.5
For detailed platform-specific installation steps, see the Linux and macOS installation guide.
Upgrading from 5.13.0
This is a drop-in hotfix release. No API changes, no configuration changes. Update via PECL or replace the DLLs on Windows.
If you are using access token authentication with connection pooling, we strongly recommend upgrading to this release.
Resources
- GitHub Repository
- Official Documentation
- PECL sqlsrv
- PECL pdo_sqlsrv
- Release Notes (CHANGELOG)
- Report Issues
Feedback
We welcome your feedback and contributions. Please file issues, feature requests and pull requests on our GitHub Issues page.