sonerezh icon indicating copy to clipboard operation
sonerezh copied to clipboard

"Incorrect string value" lors d'un import CLI

Open fschlaef opened this issue 5 years ago • 4 comments

Bonjour,

Lorsque j'utilise le Commande-line Tool pour lancer un import comme indiqué sur la doc, j'ai le message d'erreur suivant :

SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xFF\xFE' for column 'genre' at row 1

De plus, après cette erreur le suivi dans la console s'affole, affiche plein de "]" et efface le terminal (le INFO] Run import: [77%] [################################### ] retourne en arrière sans arrêt et efface le contenu de la console)

Je n'ai malheureusement pas plus d'info quand au fichier qui provoque l'erreur, cake ne produisant pas de logs (à ma connaissance en tout cas)

fschlaef avatar Dec 03 '18 10:12 fschlaef

I think there's a log in ./tmp/log IIRC

MightyCreak avatar Dec 03 '18 14:12 MightyCreak

Good call !

debug.log contains the same message over and over :

2018-12-03 11:53:53 Notice: Notice (8): compact() [<a href='http://php.net/function.compact'>function.compact</a>]: Undefined variable: subject in [/home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Utility/ObjectCollection.php, line 128]
Trace:
ErrorHandler::handleError() - APP/Vendor/cakephp/cakephp/lib/Cake/Error/ErrorHandler.php, line 230
compact - [internal], line ??
ObjectCollection::trigger() - APP/Vendor/cakephp/cakephp/lib/Cake/Utility/ObjectCollection.php, line 128
HelperCollection::trigger() - APP/Vendor/cakephp/cakephp/lib/Cake/View/HelperCollection.php, line 200
CakeEventManager::dispatch() - APP/Vendor/cakephp/cakephp/lib/Cake/Event/CakeEventManager.php, line 243
View::_render() - APP/Vendor/cakephp/cakephp/lib/Cake/View/View.php, line 938
View::renderLayout() - APP/Vendor/cakephp/cakephp/lib/Cake/View/View.php, line 546
View::render() - APP/Vendor/cakephp/cakephp/lib/Cake/View/View.php, line 481
Controller::render() - APP/Vendor/cakephp/cakephp/lib/Cake/Controller/Controller.php, line 963
Dispatcher::_invoke() - APP/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php, line 200
Dispatcher::dispatch() - APP/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 107

error.log contains a different error message

2018-12-03 11:53:12 Warning: Warning (2): exif_read_data(2dd1a8c362682149d67b4ef36a655af9.png): File not supported in [/home/me/mymusic/app/Controller/Component/ImageComponent.php, line 15]
Trace:
ErrorHandler::handleError() - APP/Vendor/cakephp/cakephp/lib/Cake/Error/ErrorHandler.php, line 230
exif_read_data - [internal], line ??
ImageComponent::resize() - APP/Controller/Component/ImageComponent.php, line 15
ImgController::index() - APP/Controller/ImgController.php, line 42
ReflectionMethod::invokeArgs() - [internal], line ??
Controller::invokeAction() - APP/Vendor/cakephp/cakephp/lib/Cake/Controller/Controller.php, line 491
Dispatcher::_invoke() - APP/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php, line 193
Dispatcher::dispatch() - APP/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php, line 167
[main] - APP/webroot/index.php, line 107

EDIT : the original error message was not logged toady for some reason, but I found it at an earlier date :

2018-11-26 11:21:50 Error: [PDOException] SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xFF\xFE' for column 'genre' at row 1
Request URL: /import
Stack Trace:
#0 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Model/Datasource/DboSource.php(472): PDOStatement->execute(Array)
#1 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Model/Datasource/DboSource.php(438): DboSource->_execute('INSERT INTO `so...', Array)
#2 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Model/Datasource/DboSource.php(1092): DboSource->execute('INSERT INTO `so...')
#3 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Model/Model.php(1942): DboSource->create(Object(Song), Array, Array)
#4 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Model/Model.php(1760): Model->_doSave(Array, Array)
#5 /home/me/mymusic/app/Controller/SongsController.php(131): Model->save(Array)
#6 [internal function]: SongsController->import()
#7 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Controller/Controller.php(491): ReflectionMethod->invokeArgs(Object(SongsController), Array)
#8 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php(193): Controller->invokeAction(Object(CakeRequest))
#9 /home/me/mymusic/app/Vendor/cakephp/cakephp/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(SongsController), Object(CakeRequest))
#10 /home/me/mymusic/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#11 {main}

fschlaef avatar Dec 03 '18 15:12 fschlaef

Your song file contains a tag that is UTF-16 encoded. And Sonerezh database uses UTF-8 for string fields. That triggers the exception. Workaround: try to locate the faulty song file and dump its tag content using an external tool.

I would have thought that getID3 library takes care of all the conversions stuff...

Nizhile avatar Feb 02 '19 22:02 Nizhile

Or you can change the charset of the mysql to utf8mb4 ;)

Neurozone avatar Jun 26 '19 11:06 Neurozone