Warning if field aliases are configured

Created on 12 July 2024, 4 months ago

Steps to reproduce

When using field aliases there are warnings when reading properties.
The result looks functional. Example:

Warning: Undefined array key "birthday" in Drupal\doc_serialization\Encoder\Docx->encode() (line 85 of modules/contrib/doc_serialization/src/Encoder/Docx.php).

Stacktrace:

Drupal\doc_serialization\Encoder\Docx->encode(Array, 'docx', Array) (Line: 43)
Symfony\Component\Serializer\Encoder\ChainEncoder->encode(Array, 'docx', Array) (Line: 416)
Symfony\Component\Serializer\Serializer->encode(Array, 'docx', Array) (Line: 141)
Symfony\Component\Serializer\Serializer->serialize(Array, 'docx', Array) (Line: 143)
Drupal\rest\Plugin\views\style\Serializer->render() (Line: 435)
Drupal\rest\Plugin\views\display\RestExport->Drupal\rest\Plugin\views\display\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 434)
Drupal\rest\Plugin\views\display\RestExport->render() (Line: 76)
Drupal\doc_serialization\Plugin\views\display\WordExport->render() (Line: 1592)
Drupal\views\ViewExecutable->render() (Line: 426)
Drupal\rest\Plugin\views\display\RestExport->execute() (Line: 1689)
Drupal\views\ViewExecutable->executeDisplay('word_export_1', Array) (Line: 81)
Drupal\views\Element\View::preRenderViewElement(Array)
call_user_func_array(Array, Array) (Line: 113)
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. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 153)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 56)
Drupal\doc_serialization\Plugin\views\display\WordExport::buildResponse('test_for_docx_export', 'word_export_1', Array) (Line: 56)
Drupal\views\Routing\ViewPageController->handle('test_for_docx_export', 'word_export_1', Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->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: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

My view config attached.

The doc is nothing special, just a DOCX with e.g. "${birthday}" as pattern.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇦🇹Austria daniel.pernold

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @daniel.pernold
  • 🇦🇹Austria daniel.pernold

    I think this is related:

    Warning: Trying to access array offset on value of type null in Drupal\doc_serialization\Encoder\Docx->encode() (line 85 of modules/contrib/doc_serialization/src/Encoder/Docx.php).

    Stacktrace:

    Drupal\doc_serialization\Encoder\Docx->encode(Array, 'docx', Array) (Line: 43)
    Symfony\Component\Serializer\Encoder\ChainEncoder->encode(Array, 'docx', Array) (Line: 416)
    Symfony\Component\Serializer\Serializer->encode(Array, 'docx', Array) (Line: 141)
    Symfony\Component\Serializer\Serializer->serialize(Array, 'docx', Array) (Line: 143)
    Drupal\rest\Plugin\views\style\Serializer->render() (Line: 435)
    Drupal\rest\Plugin\views\display\RestExport->Drupal\rest\Plugin\views\display\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 434)
    Drupal\rest\Plugin\views\display\RestExport->render() (Line: 76)
    Drupal\doc_serialization\Plugin\views\display\WordExport->render() (Line: 1592)
    Drupal\views\ViewExecutable->render() (Line: 426)
    Drupal\rest\Plugin\views\display\RestExport->execute() (Line: 1689)
    Drupal\views\ViewExecutable->executeDisplay('word_export_1', Array) (Line: 81)
    Drupal\views\Element\View::preRenderViewElement(Array)
    call_user_func_array(Array, Array) (Line: 113)
    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. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432)
    Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 248)
    Drupal\Core\Render\Renderer->render(Array, 1) (Line: 153)
    Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
    Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 56)
    Drupal\doc_serialization\Plugin\views\display\WordExport::buildResponse('test_for_docx_export', 'word_export_1', Array) (Line: 56)
    Drupal\views\Routing\ViewPageController->handle('test_for_docx_export', 'word_export_1', Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->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: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  • 🇩🇪Germany trichers

    If have the same issue:

    Warning: Undefined array key "titel" in Drupal\doc_serialization\Encoder\Docx->encode() (line 86 of modules/contrib/doc_serialization/src/Encoder/Docx.php).

    Drupal\doc_serialization\Encoder\Docx->encode() (Line: 43)
    Symfony\Component\Serializer\Encoder\ChainEncoder->encode() (Line: 416)
    Symfony\Component\Serializer\Serializer->encode() (Line: 141)
    Symfony\Component\Serializer\Serializer->serialize() (Line: 143)
    Drupal\rest\Plugin\views\style\Serializer->render() (Line: 435)
    Drupal\rest\Plugin\views\display\RestExport->Drupal\rest\Plugin\views\display\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 434)
    Drupal\rest\Plugin\views\display\RestExport->render() (Line: 76)
    Drupal\doc_serialization\Plugin\views\display\WordExport->render() (Line: 1592)
    Drupal\views\ViewExecutable->render() (Line: 426)
    Drupal\rest\Plugin\views\display\RestExport->execute() (Line: 1689)
    Drupal\views\ViewExecutable->executeDisplay() (Line: 81)
    Drupal\views\Element\View::preRenderViewElement()
    call_user_func_array() (Line: 113)
    Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 870)
    Drupal\Core\Render\Renderer->doCallback() (Line: 432)
    Drupal\Core\Render\Renderer->doRender() (Line: 248)
    Drupal\Core\Render\Renderer->render() (Line: 153)
    Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 152)
    Drupal\Core\Render\Renderer->renderRoot() (Line: 56)
    Drupal\doc_serialization\Plugin\views\display\WordExport::buildResponse() (Line: 56)
    Drupal\views\Routing\ViewPageController->handle()
    call_user_func_array() (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
    Drupal\Core\DrupalKernel->handle() (Line: 19)
Production build 0.71.5 2024