Puncte:0

unserialize(): Error at offset 0 of 18 bytes

drapel in

I am doing a migration from Drupal 7 to Drupal 8. Its using a MYSQL database (Server version: 8.0.26-0ubuntu0.20.04.2 (Ubuntu)). With this one particular node type when I drush cr and then reload the page I am given the following error.

Notice: unserialize(): Error at offset 0 of 18 bytes in Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables() (line 1288 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables(Array, ) (Line: 524)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->mapFromStorageRecords(Array) (Line: 449)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->getFromStorage(Array) (Line: 415)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->doLoadMultiple(Array) (Line: 300)
Drupal\Core\Entity\EntityStorageBase->loadMultiple(Array) (Line: 139)
Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFormatterBase->prepareView(Array) (Line: 245)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 351)
Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents(Array, Array, Array, 'full') (Line: 293)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) (Line: 250)
Drupal\Core\Entity\EntityViewBuilder->build(Array) call_user_func_array(Array, Array) (Line: 100)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. Support for this callback implementation is deprecated in 8.8.0 and will be removed in Drupal 9.0.0. See https://www.drupal.org/node/2966725', 'silenced_deprecation', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 781)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 372)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 200)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object) call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

I can see it's caused by an entity reference field. I am using the Bootstrap 4 theme and I have a template override, which is the following one.

{% if content.field_business.0%}
  <div class="dimension col-xs-12 col-md-4 col-lg-2 text-break">
    <p>Retailer: {{ content.field_business.0 }}</p>
  </div>
{% endif %}

Looking at the database table with desc node__field_business for the particular node and the rest of them I can't see any junk data.

+------------------------------+--------------+------+-----+---------+-------+
    | Field                    | Type         | Null | Key | Default | Extra |
+------------------------------+--------------+------+-----+---------+-------+
    | bundle                   | varchar(128) | NO   | MUL |         |       |
    | deleted                  | tinyint      | NO   | PRI | 0       |       |
    | entity_id                | int unsigned | NO   | PRI | NULL    |       |
    | revision_id              | int unsigned | NO   | MUL | NULL    |       |
    | langcode                 | varchar(32)  | NO   | PRI |         |       |
    | delta                    | int unsigned | NO   | PRI | NULL    |       |
    | field_business_target_id | int unsigned | NO   | MUL | NULL    |       |
+------------------------------+--------------+------+-----+---------+-------+
    7 rows in set (0.01 sec)

select entity_id, field_business_target_id from node__field_business where entity_id="429" shows the following output.

+-----------+--------------------------+
| entity_id | field_business_target_id |
+-----------+--------------------------+
|       429 |                      267 |
+-----------+--------------------------+
    1 row in set (0.00 sec)

There also does not seem to be anything in the apache2 error.log too.

[Sun Oct 03 00:00:21.635998 2021] [mpm_prefork:notice] [pid 1757] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Sun Oct 03 00:00:21.636036 2021] [core:notice] [pid 1757] AH00094: Command line: '/usr/sbin/apache2'
[Sun Oct 03 01:19:18.993276 2021] [mpm_prefork:notice] [pid 1757] AH00169: caught SIGTERM, shutting down
[Sun Oct 03 10:13:42.699740 2021] [mpm_prefork:notice] [pid 1666] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Sun Oct 03 10:13:42.709982 2021] [core:notice] [pid 1666] AH00094: Command line: '/usr/sbin/apache2'
[Sun Oct 03 13:23:39.109602 2021] [mpm_prefork:notice] [pid 1666] AH00169: caught SIGTERM, shutting down
[Sun Oct 03 19:14:05.151979 2021] [mpm_prefork:notice] [pid 1678] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[Sun Oct 03 19:14:05.152317 2021] [core:notice] [pid 1678] AH00094: Command line: '/usr/sbin/apache2'

Does anyone have any idea on how I could troubleshoot this? I am pretty sure its not the theme template to cause the issue, since I renames the template (so its not used), clear the cache and the error is still there when I refresh the page. As far as I can see the data in table in looks OK to me.

miststudent2011 avatar
drapel fr
Prin orice modificare, aveți logger în jurul apelului de funcție?
mark newton avatar
drapel in
Cred că va trebui să citesc despre asta. Totuși, îmi va lua ceva timp, deoarece nu sunt cu normă întreagă. Voi arunca o privire despre cum fac asta joi. Se pare că trebuie să activez X-debug sau ceva similar... Mulțumesc totuși pentru idee.
apaderno avatar
drapel us
Anunțul este afișat în prima linie (*Notice: unserialize(): Eroare la offset 0 din 18 octeți în Drupal\Core\Entity\Sql\SqlContentEntityStorage->loadFromDedicatedTables()*). Nu implică niciun fișier șablon, deoarece `SqlContentEntityStorage::loadFromDedicatedTables()` nu încarcă niciun fișier șablon. În ceea ce privește depanarea problemei, trebuie să instalați un depanator. În afară de a sugera asta, nu prea putem spune multe. Nu putem depana un site la care nu avem acces.

Postează un răspuns

Majoritatea oamenilor nu înțeleg că a pune multe întrebări deblochează învățarea și îmbunătățește legătura interpersonală. În studiile lui Alison, de exemplu, deși oamenii își puteau aminti cu exactitate câte întrebări au fost puse în conversațiile lor, ei nu au intuit legătura dintre întrebări și apreciere. În patru studii, în care participanții au fost implicați în conversații ei înșiși sau au citit transcrieri ale conversațiilor altora, oamenii au avut tendința să nu realizeze că întrebarea ar influența – sau ar fi influențat – nivelul de prietenie dintre conversatori.