Skip to content

Attempting to store boolean value on SQLSRV causes database exception #171

Description

@jansteffen

Attempting to store a boolean value via the settings library while using an SQLSRV database fails and causes an exception.
Minimal example:

// App/Config/App.php
public bool $myBool = true;

// Run this code somewhere else, for example in a spark command
helper('setting');
setting('App.myBool', false);

Outputs:

[CodeIgniter\Database\Exceptions\DatabaseException]
[Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Operand type clash: int is incompatible with text SQLSTATE: 22018, code: 206
at SYSTEMPATH/Database/BaseConnection.php:863

  Caused by:
  [CodeIgniter\Database\Exceptions\DatabaseException]
  [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Operand type clash: int is incompatible with text SQLSTATE: 22018, code: 206
  at SYSTEMPATH/Database/SQLSRV/Connection.php:533

Tested with:

  • PHP 8.4.23
  • CodeIgniter Framework 4.7.4
  • CodeIgniter Settings 2.3.0
  • Microsoft SQL Server 2025 (RTM-CU7) (KB5096981) - 17.0.4065.4 (X64)
  • ODBC Driver: libmsodbcsql-18.6.so.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions