Skip to content
This repository was archived by the owner on Nov 9, 2021. It is now read-only.

Conversation

@ivangrynenko
Copy link

@ivangrynenko ivangrynenko commented Nov 16, 2020

This patch needs testing

In the token module, when using token [node:book:parents:join-path] to create content that is assigned to a parnet book, PHP notice is getting triggered:
Notice: Trying to access array offset on value of type int in token_element_children() (line 608 of modules/contrib/token/token.module).token_element_children(Array, 1) (Line: 945) token_tokens('array', Array, Array, Array, Object) call_user_func_array('token_tokens', Array) (Line: 403) Drupal\Core\Extension\ModuleHandler->invokeAll('tokens', Array) (Line: 304) Drupal\Core\Utility\Token->generate('array', Array, Array, Array, Object) (Line: 1155) book_tokens('book', Array, Array, Array, Object) call_user_func_array('book_tokens', Array) (Line: 403) Drupal\Core\Extension\ModuleHandler->invokeAll('tokens', Array) (Line: 304) Drupal\Core\Utility\Token->generate('book', Array, Array, Array, Object) (Line: 1110) book_tokens('node', Array, Array, Array, Object) call_user_func_array('book_tokens', Array) (Line: 403) Drupal\Core\Extension\ModuleHandler->invokeAll('tokens', Array) (Line: 304) Drupal\Core\Utility\Token->generate('node', Array, Array, Array, Object) (Line: 196) Drupal\Core\Utility\Token->replace('resources/[node:book:parents:join-path]/[node:title]', Array, Array, Object) (Line: 228) Drupal\pathauto\PathautoGenerator->createEntityAlias(Object, 'update') (Line: 380) Drupal\pathauto\PathautoGenerator->updateEntityAlias(Object, 'update') (Line: 93) pathauto_entity_update(Object) call_user_func_array('pathauto_entity_update', Array) (Line: 403) Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array) (Line: 206) Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object) (Line: 843) Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object) (Line: 535) Drupal\Core\Entity\EntityStorageBase->doPostSave(Object, 1) (Line: 728) Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object, 1) (Line: 460) Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 837) Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object) (Line: 395) Drupal\Core\Entity\EntityBase->save() (Line: 294) Drupal\node\NodeForm->save(Array, Object) call_user_func_array(Array, Array) (Line: 114) Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52) Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593) Drupal\Core\Form\FormBuilder->processForm('node_report_content_edit_form', Array, Object) (Line: 321) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 91) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151) 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: 50) Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 115) Drupal\shield\ShieldMiddleware->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)

This PR applies the patch #2 from https://www.drupal.org/project/token/issues/3154183

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant