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 notice: Creation of dynamic property in phpthumb.class.php #214

Closed
plantheo opened this issue Jun 28, 2023 · 4 comments · Fixed by #216
Closed

Deprecation notice: Creation of dynamic property in phpthumb.class.php #214

plantheo opened this issue Jun 28, 2023 · 4 comments · Fixed by #216

Comments

@plantheo
Copy link

plantheo commented Jun 28, 2023

Hi there.
I'm getting a deprecation notice about creation of dynamic properties:

Deprecated: Creation of dynamic property phpthumb::$hash is deprecated in /vendor/james-heinrich/phpthumb/phpthumb.class.php on line 391

phpThumb() v1.7.20-202212091316

Edit: I'm using PHP 8.2

@JamesHeinrich
Copy link
Owner

Apparently dynamic properties have become deprecated in PHP 8.2:
https://php.watch/versions/8.2/dynamic-properties-deprecated

If someone wants to submit a PR with a suggestion of how to sensibly fix this I'd be interested.
Possibly prefacing the class phpthumb with #[AllowDynamicProperties] might fix that, according to the above article, but this is the first I've heard of this new deprecation, and I don't have a PHP8.2 system at hand.

@plantheo
Copy link
Author

I've tried the #[AllowDynamicProperties] but no success:
Warning: The use statement with non-compound name 'AllowDynamicProperties' has no effect...

@christianzingg
Copy link

I could sove the problem locally with adding a __set magic method to the class.
https://php.watch/versions/8.2/dynamic-properties-deprecated#__get-__set

I will submit a PR.

@JamesHeinrich
Copy link
Owner

Thank you, your PR is much appreciated.

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

Successfully merging a pull request may close this issue.

3 participants