Note: this is an interim fix – the recommended way is to update the my.cnf Mysql config file, or better, to write an app that doesn’t rely on older mysql version ‘loopholes’. Also there’s probably a better way to do it within the app config files, although this was an emergency fix for a friend, so no such research was needed.
Many legacy Yii app’s I’ve come across dont correctly write the field values when updating/inserting records. So when migrating it to a later version of MySql/Cpanel – you’ll get default value errors as it tries to update the database records with missing/bad values.
To get around this, you need to set the sql-mode setting on the server. an example for plesk: https://support.plesk.com/hc/en-us/articles/115000666509-How-to-change-the-SQL-mode-in-MySQL
To update it within the Yii app itself, you can tweak the Yii database connection to set the sql-mode variable within the app itself. A slight benefit here is that the setting it not global on the server, so other more modern app’s without such issues wont be affected.
In your main index.php file, where you have “Yii::createWebApplication…”, inbetween the createWebApplication and the run() method, insert:
$app->db->createCommand("set sql_mode = ''")->query();

If your index.php file has exactly as below, you can separate the function calls the same way as the image above
Yii::createWebApplication($config)->run();
Becomes...
$app = Yii::createWebApplication($config);
$app->db->createCommand("set sql_mode = ''")->query();
$app->run();
This will set the Yii 1.1 MySql sql-mode variable on a per-connection basis, so every call within the app will respect the setting.
Enjoy!