Skip to content

Commit e4b773c

Browse files
committed
NULL value inside UserVisitLog.php causes error
Hey, I have the following problem while doing acceptance tests: The login is not working because the codecept browser language is not set. This will cause an integrity constraint violation because the UserVisitLog.php is setting the language value to NULL but the database does not accept NULL values. So you should change the UserVisitLog.php as suggested or the user_visit_log should accept NULL values by default migration. PS: I know you can change the HTTP_ACCEPT_LANGUAGE from the PhpBrowser (I have done it) but this is a potential error source for users. Just wanted to let you know. :)
1 parent 68e883f commit e4b773c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

models/UserVisitLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static function newVisitor($userId)
3939
$model->user_id = $userId;
4040
$model->token = uniqid();
4141
$model->ip = LittleBigHelper::getRealIp();
42-
$model->language = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : null;
42+
$model->language = isset( $_SERVER['HTTP_ACCEPT_LANGUAGE'] ) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) : '';
4343
$model->browser = $browser->getBrowser();
4444
$model->os = $browser->getPlatform();
4545
$model->user_agent = $browser->getUserAgent();

0 commit comments

Comments
 (0)