yiisoft / yii

Yii PHP Framework 1.1.x
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
4.84k stars 2.28k forks source link

CMssqlColumnSchema - error when default column value is SQL SERVER system functions #4513

Closed advicente closed 1 year ago

advicente commented 1 year ago

What steps will reproduce the problem?

Define or create a NOT NULL column and set default value to function getdate() or sysdatetime().

What is the expected result?

$defaultValue = null;

The $defaultValue for this situations on method init of CMssqlColumnSchema must be NULL, and NULL must be passed to database.

What do you get instead?

$defaultValue = 'getdate';

Additional info

Q A
Yii version 1.1.27
PHP version 8.0.26
Operating system Windows
marcovtwout commented 1 year ago

@advicente Could you provide a little more code to reproduce this? It's unclear to be based on the description how exactly you are passing another default value and where you are expecting it to be returned.

Is it a regression with newer MSSQL versions or did the problem exist for longer? And can you reproduce this issue on Yii 2 as well?