prashants / webzash

Easy to use web based double entry accounting software in PHP - MySQL under MIT License
http://webzash.org
Other
208 stars 109 forks source link

Cannot input anything with version 2.7 #115

Closed deamen closed 6 years ago

deamen commented 6 years ago

No matter what I do, after I click the submit button, I get the Database error as below, how can I fix it?

Errors Database Error Error: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'user_agent' at row 1

SQL Query: INSERT INTO webzash_db.testlogs (level, date, host_ip, user, url, user_agent, message) VALUES (1, '2018-04-20 03:38:36', '172.31.0.6', 'admin', 'https://webzash.yib.net.au/groups/edit/6', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36', 'Edited Group : Current Assets')

Notice: If you want to customize this error message, create app/View/Errors/pdo_error.ctp

Stack Trace CORE/Cake/Model/Datasource/DboSource.php line 472 → PDOStatement->execute(array) CORE/Cake/Model/Datasource/DboSource.php line 438 → DboSource->_execute(string, array) CORE/Cake/Model/Datasource/DboSource.php line 1092 → DboSource->execute(string) CORE/Cake/Model/Model.php line 1940 → DboSource->create(Log, array, array) CORE/Cake/Model/Model.php line 1758 → Model->_doSave(array, array) APP/Plugin/Webzash/Model/Log.php line 123 → Model->save(array) APP/Plugin/Webzash/Controller/GroupsController.php line 165 → Log->add(string, integer) [internal function] → GroupsController->edit(string) CORE/Cake/Controller/Controller.php line 491 → ReflectionMethod->invokeArgs(GroupsController, array) CORE/Cake/Routing/Dispatcher.php line 193 → Controller->invokeAction(CakeRequest) CORE/Cake/Routing/Dispatcher.php line 167 → Dispatcher->_invoke(GroupsController, CakeRequest) APP/webroot/index.php line 117 → Dispatcher->dispatch(CakeRequest, CakeResponse) ROOT/index.php line 41 → require(string)

deamen commented 6 years ago

OK, the issue is caused by Google Chrome, the USER-AGENT is too long for user_agent varchar(100) in the logs table. Is it possible to increase the size, or have a dedicate table for user_agent, cause people say USER-AGENT can be up to 64KiB?

Firefox: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0 Chrome: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

prashants commented 6 years ago

Simple solution is to limit the string size before the data is passed on the the database. I will fix this in next release.