swoole / library

📚 Swoole Library
https://wiki.swoole.com/#/library
Apache License 2.0
239 stars 56 forks source link

PHP 8.2: 动态属性被弃用 #162

Closed assert6 closed 10 months ago

assert6 commented 1 year ago

Deprecated: Creation of dynamic property Swoole\Coroutine\Socket::$__ext_sockets_nonblock is deprecated in @swoole/library/ext/sockets.php on line 217 https://github.com/swoole/library/blob/e99c29b118784e21677a6a02030b9652632b8407/src/ext/sockets.php#L209-L219

deminy commented 1 year ago

这个没法在library里面直接修复。

可以有不同的修复方法。一个简单、直观的方法是对class \Swoole\Coroutine\Socket添加#[AllowDynamicProperties]属性,就像class \stdClass那样。

twose commented 1 year ago

可以用 WeakMap 修复