msphpsql icon indicating copy to clipboard operation
msphpsql copied to clipboard

PHP 8.3.9 / 5.12.0 / 18.03.0003 SQLSTATE[IMSSP]: An invalid attribute was designated on the PDO object

Open kahalabrands opened this issue 2 years ago • 4 comments

PHP version
PHP Version 8.3.9

PHP SQLSRV or PDO_SQLSRV version PDO_SQLSRV = 5.12.0

Microsoft ODBC Driver version
18.03.0003

SQL Server version
14.00.2052

Client operating system
Ubuntu

Table schema
N/A

Problem description
Getting the following error: SQLSTATE[IMSSP]: An invalid attribute was designated on the PDO object.

  • Not exactly sure which attribute to set or remove (if possible).

Expected behavior and actual behavior
N/A

Repro code or steps to reproduce Try to connect using PHP pdo connection with versions mentioned above.

kahalabrands avatar Jul 25 '24 01:07 kahalabrands

Do you have a repro script?

Looking at the code, it looks like the following attributes are not supported by PDO:

ATTR_FETCH_TABLE_NAMES
ATTR_FETCH_CATALOG_NAMES
ATTR_PREFETCH
ATTR_MAX_COLUMN_LEN
ATTR_CURSOR_NAME
ATTR_AUTOCOMMIT
ATTR_PERSISTENT
ATTR_TIMEOUT

v-makouz avatar Jul 25 '24 18:07 v-makouz

Ok so what do I do then. I can't remove them I don't think. I set your suggested attributes to false and the following error returns. Seems like they need to be removed completely. I set them as false as a group and individually and all tests returned the same error.

Fatal error: Uncaught PDOException: SQLSTATE[IMSSP]: An unsupported attribute was designated on the PDO object. in /home/devmarketing/shared/Medoo.php:499 Stack trace: #0 /home/devmarketing/public_html/assets/includes/medoo_test.php(21): Medoo\Medoo->__construct(Array) #1 {main} thrown in /home/devmarketing/shared/Medoo.php on line 499

kahalabrands avatar Jul 25 '24 18:07 kahalabrands

How are you calling the PHP driver? When it's invoked it looks something like: $conn = new PDO($connOptions, $uid, $pwd, array(SOME_ATTRIBUTE => VALUE, OTHER_ATTRIBUTE => VALUE2)); so as long as those attributes are not specified in the list, this error shouldn't happen.

v-makouz avatar Jul 26 '24 17:07 v-makouz

Thanks for the help on this. Come to find out there was no issues at all on this. Sorry about the 911. I am migrating to a brand new server that has brand new everything. The way I was debugging was to just look at error messages in the code. I didn't actually try to execute the query to see if I was getting data back just the pdo connection info. The connection info reports that invalid attribute error but the query actually executes and returns data. So I think we are good. I have had to try getting this installed on three different new servers and that message was popular with older versions of php not 8.3+ so I thought I was running into the same issue....a bit confusing. I think we are good. Thanks again.

kahalabrands avatar Jul 29 '24 19:07 kahalabrands