heroku-buildpack-php: Unable to install ext-mbstring
Hi, I’m currently maintaining a laravel 8 app on heroku and after an update today, i keep getting this error:
Call to undefined function Illuminate\Support\mb_strimwidth()
After diagnosing said problem, i found that adding ext-mbstring to composer.json would solve my issue. After doing that (composer update, git commit, etc.), checking the build log, heroku seems to fail to detect ext-mbstring and properly install it:
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/php
-----> PHP app detected
-----> Bootstrapping...
-----> Preparing platform package installation...
-----> Installing platform packages...
- php (8.1.2)
- ext-gd (bundled with php)
- apache (2.4.52)
- composer (2.2.5)
- nginx (1.20.2)
- ext-exif (bundled with php)
-----> Installing dependencies...
This was not an issue before, as I can see ext-mbstring being installed on previous build logs:
-----> PHP app detected
-----> Bootstrapping...
-----> Preparing platform package installation...
-----> Installing platform packages...
- php (8.1.2)
- apache (2.4.52)
- composer (2.2.5)
- nginx (1.20.2)
- ext-exif (bundled with php)
- ext-gd (bundled with php)
- ext-mbstring (bundled with php)
I’m at a loss as why this is happening now.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 6
- Comments: 15 (6 by maintainers)
Fixed and released (#541) to the official stable buildpack channel.
@EvilasioAnisio, @derrickschoen, @OscarOzaine, @TireWizardBrandon, @obj63mc, @duffn, @alkemann, @jcart, @eithed, @legend6, @pedrommone and everyone else, you can now revert your workarounds.
Thank you for your patience and enjoy your weekend!
Please bear in mind that
symfony/polyfill-mbstringdoesn’t contain all mbstring methods.Per @dzuelke though, replacing it within composer.json:
correctly bundles mbstring
Hi all!
Right now, this is intentional - Composer is, finally, resolving all dependencies correctly into a minimal set for platform installs on Heroku, and since
symfony/polyfill-mbstringis present and declaring aprovideforext-mbstring, this results in the “native”ext-mbstringnot being installed.There is work in flight to attempt installations for all
provided extensions after the main install concludes; it’ll land very soon, but no promises that this will still happen this week.In the meantime, as @OscarOzaine said, the workaround is to either:
requirepackagesymfony/polyfill-mbstringversion~1.23.1, orsymfony/polyfill-mbstringasreplaced (version*) in the root of yourcomposer.json.This issue will update once a fix has landed.
Thanks for your patience!