akalongman/sublimetext-codeformatter

mac os x php error message!!!

JieAnthony opened this issue · 3 comments

`CodeFormatter

Format error:

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php on line 5386

Call Stack:
0.0020 461544 1. {main}() /Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar:0
0.0188 3930080 2. include('phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php') /Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar:9
0.0195 3957624 3. CodeFormatter->formatCode() phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php:13566
0.0199 3968864 4. TwoCommandsInSameLine->format() phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/phpf.php:2790
0.0199 4035784 5. each() phar:///Users/anthony/Library/Application Support/Sublime Text 3/Packages/CodeFormatter/codeformatter/lib/phpbeautifier/phpf.phar/`

I would like to ask how to solve it,thank you

how?

PHP 5.5 alone is at least 3 years EOL (source) so "downgrading" to that is most likely a bad idea. each() is deprecated since version 7.2.0. I am on OSX 10.13.6 which ships with PHP version 7.1.23 so using a built-in php is a good workaround. Check your $PATH to make to make sure you don't override default php path (can be also checked via which php).

EDIT: while your $PATH can use <7.2.0, you can alias a newer PHP which you can use from the interactive shell while maintaining backwards compatibility with cli tools. As an example:

alias php='/Applications/MAMP/bin/php/php7.2.14/bin/php -c "/Library/Application Support/appsolute/MAMP PRO/conf/php7.2.14.ini"'

I am also facing the same issue with PHP 7.3.11 on Mac OS 10.15.1 on Sublime Text 3 build 3211.
Any help for this issue is highly appreciated.