Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation Warning in PHP 7.4+ due to Dynamic Property Creation #38

Open
LockeAG opened this issue Jun 12, 2023 · 3 comments
Open

Deprecation Warning in PHP 7.4+ due to Dynamic Property Creation #38

LockeAG opened this issue Jun 12, 2023 · 3 comments

Comments

@LockeAG
Copy link

LockeAG commented Jun 12, 2023

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 版本同步,以保证安全性和性能。

提前感谢您的时间和帮助!

@noaccident
Copy link
Collaborator

noaccident commented Nov 3, 2023

Hello, could you please provide the version numbers of php and sdk you are using?


你好,麻烦提供您使用的php和sdk的版本号呢?

@Risin9
Copy link

Risin9 commented Jan 2, 2024

Hello, could you please provide the version numbers of php and sdk you are using?

你好,麻烦提供您使用的php和sdk的版本号呢?

你好,我在php8.2.12,sdk3.23中也遇到了

@Risin9
Copy link

Risin9 commented Jan 2, 2024

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 版本同步,以保证安全性和性能。

提前感谢您的时间和帮助!
I have encountered the same situation as you. I am using PHP 8.2.13, and the following is my solution:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants