Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught PDOException: SQLSTATE[22007]: Invalid datetime format, MysqlEngine:68 #322

Open
menturion opened this issue Dec 15, 2024 · 1 comment

Comments

@menturion
Copy link

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

$this->index->exec("INSERT INTO ".$this->indexName."_info ( `key`, `value`) values

Without changing the types, I can solve this by disabling strict MySQL mode.

@menturion
Copy link
Author

$this->index->exec("INSERT INTO ".$this->indexName."_info ( `key`, `value`) values
( 'total_documents', 0),
( 'stemmer', 'TeamTNT\TNTSearch\Stemmer\NoStemmer'),
( 'tokenizer', 'TeamTNT\TNTSearch\Support\Tokenizer')"
);
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 ...

$this->stemmer = new $stemmer;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant