PHP

pecl安裝程序時報錯Array and string offset access syntax with curly braces is no longer supported

字號+ 編輯: 种花家 修訂: 种花家 來源: 原创 2023-09-12 我要說兩句(1)

記述一次使用不對稱版本pecl的驚險奇遇。

早些时间因为想通过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

这个错误不算大事, 纯粹一个官方纠结语法所带来的问题, 把尖括号{改为方括号即可[

閲完此文,您的感想如何?
  • 有用

    43

  • 沒用

    7

  • 開心

    18

  • 憤怒

    2

  • 可憐

    2

1.如文章侵犯了您的版權,請發郵件通知本站,該文章將在24小時内刪除;
2.本站標注原創的文章,轉發時煩請注明來源;
3.交流群: PHP+JS聊天群

相關課文
  • mac開發接入微信公衆號接口返回報錯 cURL error 56: SSLRead() return error -9806

  • PHP的換行符是什麽

  • 由於商家傳入的H5交易參數有誤,該筆交易暫時無法完成,請聯系商家解決

  • 阿裡雲控制台報dedecms注入漏洞 路逕xxx/plus/search.php

我要說說
網上賓友點評
1 樓 IP 111.192.165.181 的嘉賓 说道 : 1685501680
手动编译算了