revolution icon indicating copy to clipboard operation
revolution copied to clipboard

MODX3 Setup: Uncaught Error: Call to undefined function mb_split()

Open qodo opened this issue 5 years ago • 8 comments

Bug report

Summary

When trying out the new MODX3 Alpha 2 I get the following error message on the set-up screenn:

Fatal error: Uncaught Error: Call to undefined function mb_split() in /home/mytest/public_html/core/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php:47 Stack trace: #0 /home/mytest/public_html/core/vendor/smarty/smarty/libs/plugins/modifier.replace.php(34): smarty_mb_str_replace('[[+current_year...', '2020', '© 2005-[[+...') #1 /home/mytest/public_html/core/cache/setup/smarty/f408b021d2b46489800138ede826932f9da88e74_0.file.footer.tpl.php(37): smarty_modifier_replace('© 2005-[[+...', '[[+current_year...', '2020') #2 /home/mytest/public_html/core/vendor/smarty/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_5e37fe9d7cd3c4_44651287(Object(Smarty_Internal_Template)) #3 /home/mytest/public_html/core/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(Smarty_Internal_Template)) #4 /home/mytest/public_html/core/vendor/smarty/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_C in /home/mytest/public_html/core/vendor/smarty/smarty/libs/plugins/shared.mb_str_replace.php on line 47

Step to reproduce

This appears to be because my server defaults to php v7.0.x which I know is no longer supported but couldn't we have a check in place for this to warn the user instead as if anyone new is trying out MODX for the first time, it's not the most welcome of starts.

Observed behavior

Error as above.

Expected behavior

PHP < 7.2 I should see a warning message that older versions are not supported and I should upgrade. PHP >= 7.2 I should see the lovely new installation page.

Environment

Ubuntu server Apache 2.x Php 7.0.x

This works correctly when I switch to PHP 7.2.

Thanks!

qodo avatar Feb 03 '20 11:02 qodo

https://docs.modx.com/3.x/en/getting-started/upgrading-to-3.0/requirements

sottwell avatar Feb 03 '20 12:02 sottwell

Hmm. Appears to be some inconsistencies. https://docs.modx.com/3.x/en/getting-started/server-requirements

sottwell avatar Feb 03 '20 12:02 sottwell

@sottwell Fixed. https://github.com/modxorg/Docs/commit/f5afcf7dfe5481cba80cf3718bdefca6079f7c83

Mark-H avatar Feb 03 '20 12:02 Mark-H

Absolutely. It would be good to make sure the documentation is up-to-date and accurate. I still think it's important to add a check for the version and handle this a bit better with a proper user-friendly error message if at all possible?

qodo avatar Feb 03 '20 12:02 qodo

100%.

There's already one (not super friendly) check in the setup, but that wasn't updated when the requirements got bumped apparently.

Also the problem from your particular error seems to be that the mbstring extension isn't loaded in the 7.0 configuration. Guess that's a hard requirement for smarty now which is probably worth adding an additional check for.

Mark-H avatar Feb 03 '20 12:02 Mark-H

That's great. I'm sure I've seen these error messages in the past. Seems like there are a few checks indifferent places and the error messages are only in English (but I guess at this point they haven't selected a language?)

qodo avatar Feb 03 '20 12:02 qodo

It's also worth checking for all required/suggested extensions listed in composer.json: https://github.com/modxcms/revolution/blob/3e657b78610e881cd770d32e9ffb98a58cc5ae2f/composer.json#L58-L75

JoshuaLuckers avatar Feb 03 '20 21:02 JoshuaLuckers

It is still actual because smarty required mbstring, and we don't check it properly.

alroniks avatar Mar 30 '21 21:03 alroniks