Problem/Motivation

Using Book Tree Menu 3.x with the 3.0.7 version of the Book module resulted in fatal errors.

Steps to reproduce

Install Book 3.x and Book Tree Menu 3.x (using a require 3.0.7 as 2.0.4 composer alias for the Book module to avoid dependency conflicts) in a Drupal 11.3 site, get these fatal errors:

  • Fatal error: Declaration of Drupal\book_tree_menu\ProxyClass\oscBookManager::bookTreeAllData(int $bid, ?array $link = null, ?int $max_depth = null, ?int $min_depth = null): array must be compatible with Drupal\book\BookManagerInterface::bookTreeAllData(int $bid, ?array $link = null, ?int $max_depth = null, ?int $min_depth = null, bool $expanded = false): array in /var/www/html/web/modules/contrib/book_tree_menu/src/ProxyClass/oscBookManager.php on line 72
  • Class Drupal\book_tree_menu\ProxyClass\oscBookManager contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Drupal\book\BookManagerInterface::updateDescendantAliases) in /var/www/html/web/modules/contrib/book_tree_menu/src/ProxyClass/oscBookManager.php on line 17

Proposed resolution

  • Updating both the proxy /src/ProxyClass/oscBookManager.php and the underlying manager /src/oscBookManager.php, both bookTreeAllData() declarations need the fifth parameter; the proxy must forward it, and the manager must preserve Book 3.0.7’s expanded-tree behavior and cache separation.
  • adding updateDescendantAliases(\Drupal\book\BookInterface $node): void to the proxy, delegating to $this->lazyLoadItself()->updateDescendantAliases($node). Do not return a value or use an empty stub—the underlying Book manager already provides the required behavior

Coded with assistance from GPT-6.1 Sol.

Remaining tasks

Review, test, tweak, approve, commit.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

byronveale created an issue. See original summary.

byronveale’s picture

Issue summary: View changes
byronveale’s picture

Status: Active » Needs review
byronveale’s picture