- Issue created by @joseph.olstad
- Merge request !86Issue #3525363 by joseph.olstad: Upgrade from Drupal 10.4.7 to Drupal 11.1.7... → (Open) created by joseph.olstad
TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 40 of modules/contrib/book/src/Access/BookNodeOutlineAccessCheck.php).
Install drupal 10.4.7, book module, do not create any book nodes
Upgrade to drupal 11.1.7 , see wsod
exact use case: using wxt 5.4.2 vs 11.1.x
See patch and merge request
git diff src/Access/BookNodeOutlineAccessCheck.php
diff --git a/src/Access/BookNodeOutlineAccessCheck.php b/src/Access/BookNodeOutlineAccessCheck.php
index ec51149..0cf4e68 100644
--- a/src/Access/BookNodeOutlineAccessCheck.php
+++ b/src/Access/BookNodeOutlineAccessCheck.php
@@ -37,7 +37,8 @@ class BookNodeOutlineAccessCheck implements AccessInterface {
public function access(NodeInterface $node): AccessResultInterface {
// If content type is allowed book type, then check for 'add content to
// books' permission.
- if (in_array($node->getType(), $this->configFactory->get('book.settings')->get('allowed_types'))) {
+ $allowed_types = $this->configFactory->get('book.settings')->get('allowed_types') ?? [];
+ if (in_array($node->getType(), $allowed_types)) {
return AccessResult::allowedIfHasPermission($this->currentUser, 'add content to books')
->orif(AccessResult::allowedIfHasPermission($this->currentUser, 'administer book outlines'));
}
See patch and merge request
N/A
Fix
N/A
Needs review
2.0
Code