Problem/Motivation

Drupal 11.4.0 became available on 2026-07-01.

In Drupal 11.4.0, the node search functionality was moved to a sub-module (see change record 3590298: Node search plugin node_search moved to sub-module Search Node in Search). As part of this, \Drupal\node\Plugin\Search\NodeSearch moved to \Drupal\search_node\Plugin\Search\NodeSearch. Also, the signature of the indexStatus() function changed...

-public function indexStatus()
+public function indexStatus(): array

In trash-3.0.28, trash-3.x-dev, and trash-3.1.x-dev, there is a stub function \Drupal\trash\Plugin\Search\TrashNodeSearch::indexStatus(). Its indexStatus() function override has the signature...

public function indexStatus(): mixed

... and I guess PHP 8.3.30 (i.e.: what my local machine is testing on) doesn't consider mixed and array to be compatible.

Steps to reproduce

  1. Set up a site using Drupal core version 11.3.13
  2. Install trash-3.0.28, trash-3.x-dev, or trash-3.1.x-dev
  3. Upgrade the site to drupal-11.4.0
  4. Run database updates
    Expected behavior: the site upgrades with no errors
    Actual behavior: during system_update_11401 you see the following error message:
    > PHP Fatal error:  Declaration of Drupal\trash\Plugin\Search\TrashNodeSearch::indexStatus(): mixed must be compatible with Drupal\search_node\Plugin\Search\SearchNode::indexStatus(): array in /var/www/html/web/modules/contrib/trash/src/Plugin/Search/TrashNodeSearch.php on line 47
    >  [error]  RuntimeException: Recursive router rebuild detected. in Drupal\Core\Routing\RouteBuilder->rebuild() (line 114 of /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php) #0 /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(160): Drupal\Core\Routing\RouteBuilder->rebuild()
    > #1 /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(172): Drupal\Core\Routing\RouteBuilder->rebuildIfNeeded()
    > #2 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(729): Drupal\Core\Routing\RouteBuilder->destruct()
    > #3 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(320): Drupal\Core\DrupalKernel->terminate()
    > #4 [internal function]: Drush\Boot\DrupalBoot8->terminate()
    > #5 {main}. 
    > RuntimeException: Recursive router rebuild detected. in /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php on line 114 #0 /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(160): Drupal\Core\Routing\RouteBuilder->rebuild()
    > #1 /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(172): Drupal\Core\Routing\RouteBuilder->rebuildIfNeeded()
    > #2 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(729): Drupal\Core\Routing\RouteBuilder->destruct()
    > #3 /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php(320): Drupal\Core\DrupalKernel->terminate()
    > #4 [internal function]: Drush\Boot\DrupalBoot8->terminate()
    > #5 {main}
    
    In ProcessBase.php line 171:
    
    Unable to decode output into JSON: Syntax error
    
    Fatal error: Declaration of Drupal\trash\Plugin\Search\TrashNodeSearch::indexStatus(): mixed must be compatible with Drupal\search_node\Plugin\Search\SearchNode::indexStatus(): array in /var/www/html/web/modules/contrib/trash/src/Plugin/Search/TrashNodeSearch.php on line 47
    RuntimeException: Recursive router rebuild detected. in Drupal\Core\Routing\RouteBuilder->rebuild() (line 114 of /var/www/html/web/core/lib/Drupal/Core/Routing/RouteBuilder.php).
    

Proposed resolution

Lets try changing the signature to match 11.4.0's public function indexStatus(): array. It seems like a return type is undeclared in 10.3.x, 10.4.x, 10.5.x, 10.6.x, 11.0.x, 11.1.x, 11.2.x, and 11.3.x.

Remaining tasks

  1. Determine if a return type of :array is compatible with core ^10.3 | ^11 - @mparker17 thinks it should be
  2. Create a merge request - merge request !135 created by @mparker17 in #3 for 3.1.x branch
  3. Community review - done by @mark_fullmer in #7
  4. Maintainer review - done by @amateescu before #8
  5. Commit to 3.1.x - done by @amateescu in #8
  6. Commit to 3.x - done by @amateescu in #9
  7. Release - released in trash-3.0.29

User interface changes

None.

API changes

The signature of Drupal\trash\Plugin\Search\TrashNodeSearch::indexStatus(): mixed changes to Drupal\trash\Plugin\Search\TrashNodeSearch::indexStatus(): array.

Data model changes

None.

Issue fork trash-3607782

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

mparker17 created an issue. See original summary.

mparker17’s picture

Version: 3.x-dev » 3.1.x-dev

Lets try patching 3.1.x first... sorry for the noise.

mparker17’s picture

Issue summary: View changes

Apparently removing the return-type declaration also made PHP 8.3 unhappy; lets try : array instead.

mparker17’s picture

Issue summary: View changes
Status: Active » Needs review

Taking a look at whether a return type of :array is compatible with the versions of Drupal core that Trash supports (i.e.: ^10.3 | ^11)...

  1. A return type is undeclared in 10.3.x, 10.4.x, 10.5.x, 10.6.x, 11.0.x, 11.1.x, 11.2.x, and 11.3.x
  2. The return type is : array in 11.4.x

... so I feel confident taking the merge request out of draft status, and changing the issue status to Needs review.

@amateescu, let me know if you'd like a separate merge request for 3.x branch!

mparker17’s picture

Issue summary: View changes

(Fix unfinished sentence in issue summary)

mark_fullmer’s picture

Status: Needs review » Reviewed & tested by the community

Confirmed that this resolves the compatibility issue when using Drupal 11.4.0 and having the Search module installed. Marking as RTBC!

amateescu’s picture

Status: Reviewed & tested by the community » Fixed

Merged into 3.1.x and cherry-picked to 3.x, thanks!

Also released 3.0.29 so it's easier for everyone to upgrade to 11.4.0 :)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mparker17’s picture

Yay, thanks everyone!

mparker17’s picture

Issue summary: View changes

Updating the issue summary for record-keeping purposes. Thanks for your patience with the noise!

mparker17’s picture

Issue summary: View changes

(One more update, sorry)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.