This repository was archived by the owner on Nov 9, 2021. It is now read-only.
Patch to stop PHP notices in the token module#570
Open
ivangrynenko wants to merge 2 commits intogovCMS:1.xfrom
Open
Patch to stop PHP notices in the token module#570ivangrynenko wants to merge 2 commits intogovCMS:1.xfrom
ivangrynenko wants to merge 2 commits intogovCMS:1.xfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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