php-JiraCloud-RESTAPI icon indicating copy to clipboard operation
php-JiraCloud-RESTAPI copied to clipboard

PHP 8.2 deprecated creation of dynamic property

Open LordSimal opened this issue 2 years ago • 8 comments

In src/JsonMapperHelper.php in JiraCloud\JsonMapperHelper::setUndefinedProperty at line 25

https://github.com/lesstif/php-JiraCloud-RESTAPI/blob/main/src/JsonMapperHelper.php#L25

which is called indirectly by e.g. ComponentService->create($component)

The main source is this: https://github.com/lesstif/php-JiraCloud-RESTAPI/blob/main/src/JiraClient.php#L77

LordSimal avatar May 24 '23 12:05 LordSimal

Hi @LordSimal Thank you for reaching out to me. I need to double-check and investigate that If I drop the above codes there is no side effect because this library extremely depends on the Json mapper library.

Thank you!

lesstif avatar Jun 06 '23 14:06 lesstif

No problem. I know generated code can be quite tricky to work with. There is a similar issue in another OpenAPI generated library as you can see here: https://github.com/janephp/janephp/issues/726

LordSimal avatar Jun 06 '23 14:06 LordSimal

Deprecated: Creation of dynamic property JiraCloud\Configuration\ArrayConfiguration::$useTokenBasedAuth is deprecated in \vendor\lesstif\jira-cloud-restapi\src\Configuration\ArrayConfiguration.php on line 27 @LordSimal I also found this issue inside the specified file. Is there an easy fix?

antoniosammy avatar Sep 12 '23 13:09 antoniosammy

You can only fork this repo, adjust the code accordingly and use your fork instead in your project till janephp has fixed the core problem.

LordSimal avatar Sep 12 '23 13:09 LordSimal

Hi @LordSimal, @antoniosammy. I'm so sorry, I totally forgot this ticket in my memory.

Unfortunately, I don't write the PHP code, so it's really difficult to fix this problem. Could you give me any idea or sample code to resolve this deprecated warning, please?

Is related to

  • https://github.com/lesstif/php-jira-rest-client/issues/523

lesstif avatar Sep 26 '23 15:09 lesstif

Could we release path-version with d0b00d3ce381febc54159d52db611296f3a06ac2 fix?

solodkiy avatar Nov 17 '23 14:11 solodkiy

Hi @solodkiy. I released it as 1.6.3. Thanks!

lesstif avatar Nov 20 '23 13:11 lesstif

Looking at the last commit in https://github.com/Korbeil/jane-v8/ it seems nothing is happening related to Jane V8. What is the plan for this plugin to support upcoming PHP-Releases?

LordSimal avatar Nov 21 '23 08:11 LordSimal

@LordSimal Why did you close it? The problem is still not resolved as far as i see?

chimok avatar Nov 12 '24 14:11 chimok

@lesstif There are still more such deprecated messages i can't supress.

This code for example throw a deprecation in my rest response and i had to downgrade to PHP 8.1. Ummmm, I'm using Version 1.7.0.

<?php
require 'vendor/autoload.php';

use JiraCloud\Attachment\AttachmentService;
use JiraCloud\JiraException;

try {
    $attachmentId = 12345;
    $outDir = 'attachment_dir';
    
    $atts = new AttachmentService();
    $att = $atts->get($attachmentId, $outDir, $overwrite = true);

    var_dump($att);
} catch (JiraCloud\JiraException $e) {
    print('Error Occurred! ' . $e->getMessage());
}

chimok avatar Nov 12 '24 15:11 chimok

I closed it because nothing happend in over 1 year and I moved to my own custom implementation of the JIRA API since I don't need all endpoints.

LordSimal avatar Nov 12 '24 15:11 LordSimal

@LordSimal Understand. Indeed it looks very unfinished. But we use it in a app that is used in production :) If your own implementation is open source, please let me know.

chimok avatar Nov 15 '24 15:11 chimok

My solution is not, because its very limited to our very special usecases and therefore it doesn't provide all the functionality jira provides. But the HTTP API is not that complicated, so you should be pretty easily be able to recreate the same behavior for yourself 😉

LordSimal avatar Nov 15 '24 16:11 LordSimal