You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

php_beautifier 0.1.15与PHP 8.0.30兼容问题求助

php_beautifier 在 CentOS Stream 9 + PHP 8.0 环境下的故障求助

当前环境信息

[root@localhost kyle]# uname -a
Linux localhost.localdomain 5.14.0-391.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Nov 28 20:35:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

[root@localhost kyle]# php --version
PHP 8.0.30 (cli) (built: Aug  3 2023 17:13:08) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.30, Copyright (c) Zend Technologies
with Zend OPcache v8.0.30, Copyright (c), by Zend Technologies

故障现象

无参数运行触发错误

# php_beautifier
PHP Fatal error:  Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, resource given in /usr/bin/php_beautifier:186
Stack trace:
#0 /usr/bin/php_beautifier(186): implode()
#1 {main}
  thrown in /usr/bin/php_beautifier on line 186

尝试美化文件时同样报错

[root@localhost]# php_beautifier --input rob.php
PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /usr/share/pear/PHP/Beautifier.php:1242
Stack trace:
#0 /usr/share/pear/PHP/Beautifier/Filter/Default.filter.php(151): PHP_Beautifier->decIndent()
#1 /usr/share/pear/PHP/Beautifier/Filter.php(196): PHP_Beautifier_Filter_Default->t_close_brace()
#2 /usr/share/pear/PHP/Beautifier.php(749): PHP_Beautifier_Filter->handleToken()
#3 /usr/share/pear/PHP/Beautifier/Batch.php(301): PHP_Beautifier->process()
#4 /usr/share/pear/PHP/Beautifier/Batch/Output.php(50): PHP_Beautifier_Batch->callBeautifier()
#5 /usr/share/pear/PHP/Beautifier/Batch/Output/Files.php(43): PHP_Beautifier_Batch_Output->beautifierProcess()
#6 /usr/share/pear/PHP/Beautifier/Batch/Output/Files.php(78): PHP_Beautifier_Batch_Output_Files->get()
#7 /usr/share/pear/PHP/Beautifier/Batch.php(274): PHP_Beautifier_Batch_Output_Files->save()
#8 /usr/bin/php_beautifier(211): PHP_Beautifier_Batch->save()
#9 {main}
  thrown in /usr/share/pear/PHP/Beautifier.php on line 1242

诉求

推测是版本兼容性问题,不想耗费精力调试该工具,求助解决此问题。目前仅php_beautifier --help可用,核心功能已损坏。

内容的提问来源于stack exchange,提问作者rob boudrie

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 04:06:29