statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

CP Search is broken on PHP 7.3 #2405

Closed aryehraber closed 5 years ago

aryehraber commented 5 years ago

Describe the bug It seems the CP Search doesn't work since upgrading to PHP 7.3.

To Reproduce Steps to reproduce the behavior:

  1. Upgrade server to PHP 7.3
  2. Update search index (/cp/search/update)
  3. Search for something
  4. Nothing happens, and there's an error in logs

Expected behavior For search results to show.

Environment details (please complete the following information):

Additional context

Partial of stack trace:

[2019-06-04 08:19:05] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined function Statamic\Search\Comb\mb_ereg_replace() in /sites/[website]/statamic/core/Search/Comb/Comb.php:380
Stack trace:
#0 /sites/[website]/statamic/core/Search/Comb/Comb.php(247): Statamic\Search\Comb\Comb->preformat('chair')
#1 /sites/[website]/statamic/core/Search/Comb/Index.php(82): Statamic\Search\Comb\Comb->lookUp('chair')
#2 /sites/[website]/statamic/core/Search/Search.php(33): Statamic\Search\Comb\Index->search('chair', NULL)
#3 /sites/[website]/statamic/core/API/Search.php(28): Statamic\Search\Search->search('chair', NULL)
#4 /sites/[website]/statamic/core/Http/Controllers/SearchController.php(52): Statamic\API\Search::get('chair')
#5 [internal function]: Statamic\Http\Controllers\SearchController->search(Object(Illuminate\Http\Request))
#6 /sites/[website]/statamic/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(256): call_user_func_array(Array, Array)
#7 /sites/[website]/statamic/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(164): Illuminate\Routing\Controller->callAction('search', Array)
#8 /sites/[website]/statamic/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(112): Illuminate\Routing\ControllerDispatcher->call(Object(Statamic\Http\Controllers\SearchController), Object(Illuminate\Routing\Route), 'search')
#9 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
...
jackmcdade commented 5 years ago

That's super weird, mb_ereg_replace() wasn't deprecated in PHP 7.3. 🤔

aryehraber commented 5 years ago

Apologies! It seems during the upgrade to 7.3, the mbstring package wasn't also upgraded.

Just ran apt-get install -y php7.3-mbstring and now we're back in business.

jackmcdade commented 5 years ago

Huzzah!