早些时间因为想通过pecl安装event插件, 于是乎发生了这样的场景:
user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/PEAR/Config.php on line 2095 user1@some-instances:~# vim /usr/share/php/PEAR/Config.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/PEAR/Registry.php on line 1190 user1@some-instances:~# vim /usr/share/php/PEAR/Registry.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/PEAR/Registry.php on line 1241 user1@some-instances:~# vim /usr/share/php/PEAR/Registry.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/PEAR/Registry.php on line 1265 user1@some-instances:~# vim /usr/share/php/PEAR/Registry.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/PEAR/Registry.php on line 2207 user1@some-instances:~# vim /usr/share/php/PEAR/Registry.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/PEAR/DependencyDB.php on line 177 user1@some-instances:~# vim /usr/share/php/PEAR/DependencyDB.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/PEAR/Installer/Role.php on line 240 user1@some-instances:~# vim /usr/share/php/PEAR/Installer/Role.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/System.php on line 268 user1@some-instances:~# vim /usr/share/php/System.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/Console/Getopt.php on line 129 user1@some-instances:~# vim /usr/share/php/Console/Getopt.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/Console/Getopt.php on line 144 user1@some-instances:~# vim /usr/share/php/Console/Getopt.php user1@some-instances:~# pecl install event Fatal error: Array and string offset access syntax with curly braces is no longer supported in /usr/share/php/Console/Getopt.php on line 147 user1@some-instances:~# vim /usr/share/php/Console/Getopt.php user1@some-instances:~# pecl install event
当时我就蒙了, 我在干什么? 我一个劲儿的vim那些老的php程序, 到底想干嘛? 堂堂一个php7.4的环境怎么报这么多错误? 后来回忆了一波history, 发现自己不小心用系统自带安装包管理工具安装过php-pear, 果断卸载。
之后就提示找不到pecl命令了, 巡视了一番, 看样子原来环境下的php没被破坏, 运行以下命令来解决
ln -s /usr/local/php/bin/pecl /usr/bin/pecl
这个时候再运行
pecl install event
解决问题
Fatal error: Array and string offset access syntax with curly braces is no longer supported
这个错误不算大事, 纯粹一个官方纠结语法所带来的问题, 把尖括号{改为方括号即可[