Hello,

I just updated Drupal in version 8.4 and Search 404 no longer works.

When I run a 404 search, the site displays :

The website encountered an unexpected error. Please try again later.

The log message is :

Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException: The "search_page" entity type did not specify a "search" form class. in Drupal\Core\Entity\EntityTypeManager->getFormObject() (line 184 of /home/www.s1biose.com/public_html/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php).

Comments

zenimagine created an issue. See original summary.

jurgenhaas’s picture

Priority: Major » Critical

I'm having the same issue and I can't figure out what's wrong. The error is triggered by this call in Search404Controller::search404Page() line 157:

$build['search_form'] = $this->entityFormBuilder()->getForm($entity, 'search');

As a workaround I have just commented out that line and that gives me back the site in a working state.

jurgenhaas’s picture

StatusFileSize
new718 bytes
zenimagine’s picture

Thanks, I confirm that the patch works

jurgenhaas’s picture

Let me just emphasize, this is not fixing the problem! It just avoids the error but it also doesn't render the form on top of the search page. So, this issue needs a real fix and the patch really only keeps the site up and running for now.

anybody’s picture

I can confirm this problem on all of our 8.4 installations.

cllamas’s picture

same problem here

gmrmedia’s picture

After update core from 8.3 to 8.4 same problem.
Comment on the line marked by jurgenhaas works but turns off the search form.

jurgenhaas’s picture

There are more problems in that controller, e.g. $plugin->setSearch($keys, $request->query->all(), $request->attributes->all()); expects a string where it gets keys as an array. And a lot more small things.

I'd be happy to contribute and help fixing that stuff, but it feels like this module is not really maintained. What is the status here?

anish.a’s picture

I am working on it to provide a fix now.

jurgenhaas’s picture

That's great news, thanks @anish.a

anish.a’s picture

Assigned: Unassigned » anish.a
anish.a’s picture

Status: Active » Needs review
StatusFileSize
new971 bytes

This fixes the issue.

anish.a’s picture

akhilavnair’s picture

StatusFileSize
new947 bytes
new622 bytes

Hi,
I'm having the same issue.

@anish.a thanks for the patch. The patch from #13 works fine. But the patch contains double assignment,
$build['search_form'] = $build['search_form'] = .......
I think this is not necessary, so if you don't mind, I have updated the patch.

Thank you.

anish.a’s picture

Can we just merge this?

gmrmedia’s picture

This patch dosent work in my case. I still get this db log:

InvalidArgumentException: The form argument Drupal\search404\Controller\SearchPageForm is not a valid form. in Drupal\Core\Form\FormBuilder->getFormId() (line 190 of /var/www/vhosts/xxx/core/lib/Drupal/Core/Form/FormBuilder.php).

akhilavnair’s picture

Status: Needs review » Reviewed & tested by the community

Patch from #15 works fine in Drupal version 8.4.0.

jurgenhaas’s picture

Confirmed, #15 working fine here too. I don't see the issue from #17.

  • anoopjohn committed a95c433 on 8.x-1.x authored by anish.a
    Issue #2915329 by akhilavnair_zyxware, jurgenhaas, anish.a: "Search 404...
anoopjohn’s picture

Assigned: anish.a » Unassigned
Status: Reviewed & tested by the community » Fixed

Patch in #2915329-15: "Search 404" no longer works with "Drupal 8.4" has been committed to the dev branch

gmrmedia’s picture

My mistake, i took file from repo and everything work fine on 8.4.
anish.a thank you for patch ;)

Status: Fixed » Closed (fixed)

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

rgalaxy’s picture

Hi guys, i have same problem and would like to fix it with the patch, but i dont really understand how to patch it? can anybody help me? does it needs to be written on drush?

anybody’s picture

Just install the latest version. No need for patches here anymore :) It has been commited.

rgalaxy’s picture

umm, is it possible to just update it from Drupal UI on my website? because i dont really understand if i really need to uninstall the late version and install the altest version on my production site :D Thank you btw !

gmrmedia’s picture

Go to: Reports > Available updates > update tab :) or read https://www.drupal.org/docs/user_guide/en/security-update-module.html

mlncn’s picture

Just a ping to the maintainers that a critical fix such as this warrants a beta3 release!

rgalaxy’s picture

thanks gmrmedia ! it was already up to date to the latest version on update tab. so i decided to ask my colleague and he helped me to patch it.