Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format, MysqlEngine:68
Hi, I am getting the following error:
PHP Fatal error: Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'TeamTNTTNTSearchStemmerNoStemmer' for column 'value' at row 2 in /MysqlEngine:68
https://github.com/teamtnt/tntsearch/blob/781e0eec1a1f56db0cdc2936849c508482b25547/src/Engines/MysqlEngine.php#L68
Without changing the types, I can solve this by disabling strict MySQL mode.
https://github.com/teamtnt/tntsearch/blob/781e0eec1a1f56db0cdc2936849c508482b25547/src/Engines/MysqlEngine.php#L68-L72 needs to be escaped like ...
$this->index->exec("INSERT INTO ".$this->indexName."_info ( `key`, `value`) values
( 'total_documents', 0),
( 'stemmer', 'TeamTNT\\\\TNTSearch\\\\Stemmer\\\\NoStemmer'),
( 'tokenizer', 'TeamTNT\\\\TNTSearch\\\\Support\\\\Tokenizer')"
);
Otherwise string "TeamTNTTNTSearchStemmerNoStemmer" gets stored in the DB which isn't a valid stemmer class instantiated at \teamtnt\tntsearch\src\TNTSearch.php:325, see ...
https://github.com/teamtnt/tntsearch/blob/781e0eec1a1f56db0cdc2936849c508482b25547/src/TNTSearch.php#L325
Hello @menturion
this should be fixed by the current release - the issue was that the value field was of type INT.
But since there is a possible follow-up bug I created the pull request #340 :) It should take care of this issue.
Hey @menturion this should be fixed now (in master). It has not been tagged yet, though 😅
Hey @nticaric this should be fixed and can probably be closed, as soon as a new minor version gets released :)