Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293655

"Undefined array key" error from Drupal\Core\Cache\DatabaseBackend->get

$
0
0

Drupal\Core\Cache\DatabaseBackend->get() can raise an "Undefined array key" error.

------ Original report ------
Sometimes I get the following in watchdog when saving a file to s3. The strange thing is that the file is uploaded.

Warning: Undefined array key "s3fs:uri:s3://attachments/test.pdf" in Drupal\Core\Cache\DatabaseBackend->getMultiple() (regel 121 van /data/code/project/www/core/lib/Drupal/Core/Cache/DatabaseBackend.php)
#0 /data/code/project/www/core/includes/bootstrap.inc(347): _drupal_error_handler_real(2, 'Undefined array...', '/data/code/jobb...', 121)
#1 /data/code/project/www/core/lib/Drupal/Core/Cache/DatabaseBackend.php(121): _drupal_error_handler(2, 'Undefined array...', '/data/code/jobb...', 121)
#2 /data/code/project/www/core/lib/Drupal/Core/Cache/DatabaseBackend.php(92): Drupal\Core\Cache\DatabaseBackend->getMultiple(Array, false)
#3 /data/code/project/www/modules/contrib/s3fs/src/StreamWrapper/S3fsStream.php(1391): Drupal\Core\Cache\DatabaseBackend->get('s3fs:uri:s3://a...')
#4 /data/code/project/www/modules/contrib/s3fs/src/StreamWrapper/S3fsStream.php(1362): Drupal\s3fs\StreamWrapper\S3fsStream->readCache('s3://attachment...')
#5 /data/code/project/www/modules/contrib/s3fs/src/StreamWrapper/S3fsStream.php(1283): Drupal\s3fs\StreamWrapper\S3fsStream->getS3fsObject('s3://attachment...')
#6 /data/code/project/www/modules/contrib/s3fs/src/StreamWrapper/S3fsStream.php(1098): Drupal\s3fs\StreamWrapper\S3fsStream->stat('s3://attachment...')
#7 [internal function]: Drupal\s3fs\StreamWrapper\S3fsStream->url_stat('s3://attachment...', 6)
#8 /data/code/project/www/core/lib/Drupal/Core/File/FileSystem.php(559): file_exists('s3://attachment...')
#9 /data/code/project/www/modules/contrib/s3fs/src/S3fsFileService.php(429): Drupal\Core\File\FileSystem->getDestinationFilename('s3://attachment...', 0)
#10 /data/code/project/www/core/modules/file/src/Upload/FileUploadHandler.php(193): Drupal\s3fs\S3fsFileService->getDestinationFilename('s3://attachment...', 0)
#11 /data/code/project/www/core/modules/file/file.module(846): Drupal\file\Upload\FileUploadHandler->handleFileUpload(Object(Drupal\file\Upload\FormUploadedFile), Array, 's3://attachment...', 0)
#12 /data/code/project/www/core/modules/file/file.module(722): file_save_upload('field_objection...', Array, 's3://attachment...', NULL, 0)
#13 /data/code/project/www/core/modules/file/file.module(1447): _file_save_upload_from_form(Array, Object(Drupal\Core\Form\FormState))
#14 /data/code/project/www/core/modules/file/src/Element/ManagedFile.php(76): file_managed_file_save_upload(Array, Object(Drupal\Core\Form\FormState))
#15 /data/code/project/www/modules/custom/project/src/Plugin/Field/FieldWidget/AdditionsFileWidget.php(324): Drupal\file\Element\ManagedFile::valueCallback(Array, Array, Object(Drupal\Core\Form\FormState))
#16 [internal function]: Drupal\project\Plugin\Field\FieldWidget\AdditionsFileWidget::value(Array, Array, Object(Drupal\Core\Form\FormState))
#17 /data/code/project/www/core/lib/Drupal/Core/Form/FormBuilder.php(1268): call_user_func_array(Array, Array)

Steps to reproduce

$cache = \Drupal::cache();
$cache->set('test1', 'lowercase');
$cache->get('test1'); //  Good here
$cache->get('test1 '); // The trailing space causes an issues because mysql ignores trailing spaces on primary keys and will return a result of cid 'test1' instead of 'test1 '

Viewing all articles
Browse latest Browse all 293655

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>