-
Notifications
You must be signed in to change notification settings - Fork 374
Description
PHP Driver version or file name
php-sqlsrv-5.8.0
SQL Server version
Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0
Client operating system
CentOS Linux release 7.6.1810 (Core). Linux 3.10.0-957.12.1.el7.x86_64 x86_64 GNU/Linux
PHP version
PHP 7.4.3 (cli) (built: Feb 27 2020 15:30:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans
with ddtrace v0.46.0, Copyright Datadog, by Datado
Microsoft ODBC Driver version
msodbcsql17-17.4.1.1-1.x86_64
Table schema
DECLARE @t1 TABLE (C1 NVARCHAR(10), C2 NTEXT)
Problem description
If you use the prepared statement option SQLSRV_ATTR_DIRECT_QUERY = true, in addition to using SET TEXTSIZE away from the default -1, then you get a php fatal error Invalid sql_display_size
Expected behavior and actual behavior
Output should be one row from table, C1 = TEST1, C2 = NULL
You can get this output in the default settings of the attached program.
But with settings DB_OPTIONS=1 DB_SET_TEXTSIZE=1 you get
PHP Fatal error: Invalid sql_display_size
Repro code or steps to reproduce
You need to pass the database connection credentials to the attached php program using environment variables. To reproduce the error
env DB_SERVER=localhost DB_NAME=master DB_USER=user1 DB_PASS=pass1 DB_OPTIONS=1 DB_SET_TEXTSIZE=1 php error.php
But either of these combinations will produce correct output
env DB_SERVER=localhost DB_NAME=master DB_USER=user1 DB_PASS=pass1 DB_OPTIONS=0 DB_SET_TEXTSIZE=1 php error.php
env DB_SERVER=localhost DB_NAME=master DB_USER=user1 DB_PASS=pass1 DB_OPTIONS=1 DB_SET_TEXTSIZE=0 php error.php