jolicode / slack-php-api

:hash: PHP Slack Client based on the official OpenAPI specification
https://jolicode.github.io/slack-php-api/
MIT License
221 stars 54 forks source link

Creation of dynamic property JoliCode\Slack\Api\Endpoint\ChatPostMessage::$formParameters is deprecated #152

Closed manuel-rabade closed 5 months ago

manuel-rabade commented 1 year ago

Seems to be a PHP 8.2 issue https://php.watch/versions/8.2/dynamic-properties-deprecated

lyrixx commented 1 year ago

Can you share a stack strace? Thanks

manuel-rabade commented 1 year ago

Sure @lyrixx , here it is:

2023-04-20 00:06:59 notice: Creation of dynamic property JoliCode\Slack\Api\Endpoint\ChatPostMessage::$formParameters is deprecated
Trace:
JoliCode\Slack\Api\Endpoint\ChatPostMessage::__construct() /home/vagrant/code/sistema/cake/vendor/jolicode/slack-php-api/generated/Endpoint/ChatPostMessage.php, line 49
JoliCode\Slack\Api\Client::chatPostMessage() /home/vagrant/code/sistema/cake/vendor/jolicode/slack-php-api/generated/Client.php, line 1806
App\Utility\SlackLib::post() /home/vagrant/code/sistema/cake/src/Utility/SlackLib.php, line 77
App\Utility\SlackLib::enviarMensaje() /home/vagrant/code/sistema/cake/src/Utility/SlackLib.php, line 44
App\Command\MonitorClasicosCommand::execute() /home/vagrant/code/sistema/cake/src/Command/MonitorClasicosCommand.php, line 29
Cake\Console\BaseCommand::run() /home/vagrant/code/sistema/cake/vendor/cakephp/cakephp/src/Console/BaseCommand.php, line 189
Cake\Console\CommandRunner::runCommand() /home/vagrant/code/sistema/cake/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 334
Cake\Console\CommandRunner::run() /home/vagrant/code/sistema/cake/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 172
[main] /home/vagrant/code/sistema/cake/bin/cake.php, line 12
SteenSchutt commented 12 months ago

I'm getting the same thing. Would just like to add that a quick fix could be to add the #[\AllowDynamicProperties] attribute. I don't know anything about JanePHP to know whether that's a workable solution, though.

My stack trace is the same though, so interesting that it only happens for that field in particular.

ErrorException: Deprecated: Creation of dynamic property JoliCode\Slack\Api\Endpoint\ChatPostMessage::$formParameters is deprecated
#2 /var/www/html/vendor/jolicode/slack-php-api/generated/Endpoint/ChatPostMessage.php(49): JoliCode\Slack\Api\Endpoint\ChatPostMessage::__construct
#1 /var/www/html/vendor/jolicode/slack-php-api/generated/Client.php(1806): JoliCode\Slack\Api\Client::chatPostMessage
#0 /var/www/html/cron/cron.php(47): null
mlahargou commented 10 months ago

Thanks for this api! Any update on this? It's affecting us as well.

If you are okay with adding #[\AllowDynamicProperties], I can totally open a PR here.

calincc commented 7 months ago

I'm getting the same error for ChatUpdate. Declaring the properties or adding #[\AllowDynamicProperties] should solve this