This repository was archived by the owner on Jan 13, 2022. It is now read-only.
This repository was archived by the owner on Jan 13, 2022. It is now read-only.
Received a fatal because mb_substr was not found. #546
Closed
Description
Hi,
I received a fatal error because multibyte support was not enabled and because the application was looking for mb_string in namespace Facebook\PseudoRandomString
it wasn't able to find it.
Aparently you only get the notification about the mbstring extension when you install through composer (which we didn't do because of our architecture).
composer install
Problem 1
- The requested PHP extension ext-mbstring * is missing from your system. Install or enable PHP's mbstring extension.
Simple solution is to validate that the module is loaded in code and throw an exception if not (might break BC for everyone not using composer install. Even though this is a BC, I rather have an exception that's captured at the top-level than a Fatal killing all processes.
if(1 !== extension_loaded('mbstring')) {
throw new \RuntimeException('Multibyte support required');
}
Then load the function with proper \
root reference.
return \mb_substr(\bin2hex($binaryData), 0, $length);
Metadata
Metadata
Assignees
Labels
No labels