I'm not entirely sure how this:
$v['title']
can be null ? What page does it show null on ?
PHP 8.2 - Community Input
- burt
- Core Team
- Posts: 4546
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: PHP 8.2 - Community Input
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.
-
Omar_one
- Senior Contributor
- Posts: 676
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: PHP 8.2 - Community Input
I am reading about what's new and changed on PHP 8.2
Dynamic Properties Deprecated
One of the most notable deprecations in PHP 8.2 is that it deprecates class properties that are dynamically declared. There is an opt-out to it, but the recommended approach is to declare the class properties in the class declaration, preferably with a type declaration as well.
It is likely that many legacy PHP applications will be affected by this change, because legacy applications tend to not declare class properties when they are extended, or evolved over the years with changes.
The recommended fix is to declare the properties in the class:
There are opt-outs and exceptions to this deprecation too:
stdClass and its subclasses
Classes with __get and __set magic methods
Classes with the new #[AllowDynamicProperties] attribute
Dynamic Properties Deprecated
One of the most notable deprecations in PHP 8.2 is that it deprecates class properties that are dynamically declared. There is an opt-out to it, but the recommended approach is to declare the class properties in the class declaration, preferably with a type declaration as well.
Code: Select all
class User {
public int $uid;
}
$user = new User();
$user->name = 'Foo';
Code: Select all
Deprecated: Creation of dynamic property User::$name is deprecated in ... onThe recommended fix is to declare the properties in the class:
Code: Select all
class User {
public int $uid;
public string $name;
}
$user = new User();
$user->name = 'Foo';
stdClass and its subclasses
Classes with __get and __set magic methods
Classes with the new #[AllowDynamicProperties] attribute
-
Omar_one
- Senior Contributor
- Posts: 676
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: PHP 8.2 - Community Input
Code: Select all
PHP Deprecated: Creation of dynamic property paypal_hook_admin_orders_tab::$_app is deprecated in /home/shop/public_html/includes/apps/paypal/hooks/admin/orders/tab.php on line 25
Code: Select all
$this->_app = $OSCOM_PayPal;-
Denzel
- Member
- Posts: 87
- Joined: Sat Oct 31, 2020 7:22 pm
- Phoenix Version:
- Has thanked: 9 times
- Been thanked: 15 times
Re: PHP 8.2 - Community Input
Found this fix for deprecated utf8_encodeOmar_one wrote: ↑Fri Nov 03, 2023 7:34 pm more PHP DeprecatedCode: Select all
PHP Deprecated: substr(): Passing null to parameter #1 ($string) of type string is deprecated in /home/shop/public_html/includes/apps/paypal/OSCOM_PayPal.php on line 238 PHP Deprecated: Function utf8_encode() is deprecated in /home/shop/public_html/includes/apps/paypal/api/GetBalance.php on line 34
Code: Select all
utf8_encode($link) -> mb_convert_encoding( $link, "UTF-8", mb_detect_encoding($link))-
Omar_one
- Senior Contributor
- Posts: 676
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: PHP 8.2 - Community Input
Code: Select all
Deprecated: Creation of dynamic property mime::$lf is deprecated in /home/xxxx/public_html/includes/system/versioned/1.0.4.5/mime.php on line 46Code: Select all
// Make sure we use the correct linfeed sequence
if (EMAIL_LINEFEED == 'CRLF') {
$this->lf = "\r\n";
} else {
$this->lf = "\n";
}