Hello,
I am currently using the huaweicloud-sdk-php-obs SDK in a PHP 7.4+ environment and encountered a deprecation warning when using the CheckoutStream class.
The exact warning is:
PHP Deprecated: Creation of dynamic property Obs\Internal\Common\CheckoutStream::$stream is deprecated in /home/wp-content/plugins/dreams-huawei-obs-uploader/huaweicloud-sdk-php-obs/Obs/Internal/Common/CheckoutStream.php on line 31
Even though the $stream property is explicitly declared in the CheckoutStream class, the warning is being triggered. I suspect it might be related to how the $stream property is accessed or modified via the StreamDecoratorTrait from the GuzzleHttp\Psr7 package. It could be that the property is being accessed or modified in a way that's deprecated in PHP 7.4+.
Could you please investigate this issue and provide a fix or workaround? This deprecation warning could turn into a breaking change in future versions of PHP, and it's important for us to keep our environment up-to-date with the latest PHP version for security and performance reasons.
Thank you in advance for your time and help!
标题: 在 PHP 7.4+ 中因动态属性创建而出现弃用警告
正文:
您好,
我目前在 PHP 7.4+ 环境中使用 huaweicloud-sdk-php-obs SDK,并在使用 CheckoutStream 类时遇到了一个弃用警告。
准确的警告是:
PHP 已弃用:在 /home/wp-content/plugins/dreams-huawei-obs-uploader/huaweicloud-sdk-php-obs/Obs/Internal/Common/CheckoutStream.php 的第 31 行,创建动态属性 Obs\Internal\Common\CheckoutStream::$stream 已被弃用。
尽管 $stream 属性在 CheckoutStream 类中明确声明了,但是仍然触发了警告。我怀疑这可能与 $stream 属性通过 GuzzleHttp\Psr7 包中的 StreamDecoratorTrait 被访问或修改的方式有关。可能是以一种在 PHP 7.4+ 中已被弃用的方式访问或修改了属性。
您能否请调查此问题并提供解决方案或解决方法?这个弃用警告可能在未来的 PHP 版本中变成一个破坏性的变化,而我们需要保持我们的环境与最新的 PHP 版本同步,以保证安全性和性能。
提前感谢您的时间和帮助!