php-telegram-bot / core

PHP Telegram Bot based on the official Telegram Bot API
MIT License
3.78k stars 947 forks source link

"PHP Deprecated: ... " #1454

Open emresaracoglu opened 1 month ago

emresaracoglu commented 1 month ago

Hello,

I have recently seen the following error occur. I have updated the library with Composer but the same errors still occur. How can I solve it?

Thank you.

PHP 8.2

PHP Deprecated: Creation of dynamic property Longman\TelegramBot\Entities\ServerResponse::$ok is deprecated in /var/www/***/vendor/longman/telegram-bot/src/Entities/Entity.php on line 81; PHP message: PHP Deprecated: Creation of dynamic property Longman\TelegramBot\Entities\ServerResponse::$result is deprecated in /var/www/***/vendor/longman/telegram-bot/src/Entities/Entity.php on line 81; PHP message: PHP Deprecated: Creation of dynamic property Longman\TelegramBot\Entities\ServerResponse::$raw_data is deprecated in /var/www/***/vendor/longman/telegram-bot/src/Entities/Entity.php on line 81; PHP message: PHP Deprecated: Creation of dynamic property Longman\TelegramBot\Entities\ServerResponse::$bot_username is deprecated in /var/www/***/vendor/longman/telegram-bot/src/Entities/Entity.php on line 81" while reading response header from upstream, client: 23.88.105.37, server: example.com, request: "GET /wos/cron HTTP/1.1", upstream: "fastcgi://unix:/var/lib/php7.4-fpm/web3.sock:", host: "example.com"

Hitmare commented 1 month ago

Hello

As far as i'm aware PHP 8.2 isn't fully supported yet. please use php 8.1 if you can. This bug is known and worked on.

emresaracoglu commented 1 month ago

If it is a known bug and a solution is sought, I may need to close the topic. Thank you for your response

dereuromark commented 3 weeks ago

https://github.com/php-telegram-bot/core/blob/57a649cfcfe35883165c19942b460ea6b2dfd606/.github/workflows/tests.yaml#L19 looks to me like a lie :)

After https://github.com/php-telegram-bot/core/blob/develop/phpunit.xml.dist#L13

It should never silence errors in test suite IMO

Also, this is an easy fix - after removing the silencing. It can be fixed in a BC way by just adding the properties as expected by modern PHP