Closed davidbehler closed 5 months ago
We've run into the same issue, it'd be great to have this nipped in the bud. I'd be willing to help with the PR.
I've identified another instance of dynamic property creation here;
PHP Deprecated: Creation of dynamic property WhichBrowser\Model\Os::$build is deprecated in /var/www/html/vendor/whichbrowser/parser/src/Analyser/Header/Useragent/Os.php on line 609
Same issue here
Any update? Thanks!
since php 8.2 is getting more and more attention in the real world (https://packagist.org/php-statistics) it would be nice to see this merged. We have built and open source CMS which where the user login process relays on the verification of user agents using this library, so all the projects can not upgrade to php 8.2.
@NielsLeenheer maybe there is someone you could add as maintain user, in order to help whenever there is no or less time. This is something i would recommend any open source library which is a certain amount of downloads and is therefore relevant for the php eco system. :pray:
update #1: I just saw there is @mariotsi, maybe he can merge this PR? update #2: The package is super duper relevant i would say! https://packagist.org/packages/whichbrowser/parser/stats :+1:
Thanks for the great library and your time spending on this.
any update on this?
I've found a note about adding #[AllowDynamicProperties] (https://php.watch/versions/8.2/dynamic-properties-deprecated) before classes where they are encountered. But if WhichBrowser no longer being updated....
Tested on
PHP v8.2 whichbrowser/parser v2.1.7
file: vendor\whichbrowser\parser\src\Analyser\Header\Useragent.php
Change
class Useragent { use Useragent\Os, Useragent\Device, Useragent\Browser, Useragent\Application, Useragent\Using, Useragent\Engine, Useragent\Bot;
// Initialize $data and $options properties
public function __construct($header, &$data, &$options)
{
To
class Useragent { use Useragent\Os, Useragent\Device, Useragent\Browser, Useragent\Application, Useragent\Using, Useragent\Engine, Useragent\Bot;
// Initialize $data and $options properties
private $data;
private $options;
public function __construct($header, &$data, &$options)
{
Fixed in the latest release
Not sure what the right format for issues is. Let me know if you need more/different information.
What's the issue? When using this package with PHP 8.2, I get the following E_DEPRECATED notices:
How can this be fixed? It should be as easy as adding the
$data
and$options
to the class definition. There might be other classes that need to be updated despite theWhichBrowser\Analyser\Header\Useragent
one.Do you want me to send a pull request or is an update for 8.2 already in the works?