Skip to content

Dynamic property deprecated error in ToolkitServiceParameter.php #189

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

Closed
alanseiden opened this issue Aug 3, 2023 · 2 comments · Fixed by #192
Closed

Dynamic property deprecated error in ToolkitServiceParameter.php #189

alanseiden opened this issue Aug 3, 2023 · 2 comments · Fixed by #192
Assignees
Labels

Comments

@alanseiden
Copy link
Collaborator

A developer writes:
We ran into trouble with an RPG program call in PHP 8.2.

Exception: PHP ERROR Exception: [Creation of dynamic property ToolkitApi\\PackedDecParam::$returnParameter is deprecated][8192]; File: [\/QOpenSys\/chroots\/php8_2\/QOpenSys\/pkgs\/lib\/php\/ToolkitApi\/ToolkitServiceParameter.php]; Line Number: [66]

The constructor is setting a returnParameter that isn't declared. I added this below line below 23
protected $returnParameter;

(This is only a deprecation, but their framework elevated it into an exception. We should correct the issue now.)

@alanseiden
Copy link
Collaborator Author

More info about the deprecation: https://stitcher.io/blog/deprecated-dynamic-properties-in-php-82

@alanseiden
Copy link
Collaborator Author

I asked what kind of code triggers the deprecation notice.

Anything that creates an instance of ToolkitServiceParameter is going to generate a warning.
We've got the code wrapped, so this isn't exactly it, but it will be something like this:

include_once 'iToolkitService.php';

$toolkit = \ToolkitService::getInstance('', '', '');
$params = [];
$params []= $this->toolkit->AddParameterPackDec('both',10,0,'P1','P1',0);
$result = $this->toolkit->PgmCall('PGM1','MYLIB',$params, null, null);

NattyNarwhal added a commit that referenced this issue Aug 21, 2023
this was neglected to be defined, should fix GH-189
NattyNarwhal added a commit that referenced this issue Aug 28, 2023
Fix dynamic property creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants