PHP 8.2 - Community Input

Open to all! Ask other shopowners for help.
User avatar
burt
Core Team
Posts: 4546
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: PHP 8.2 - Community Input

Post by burt »

I'm not entirely sure how this:

$v['title']

can be null ? What page does it show null on ?
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
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

Post by Omar_one »

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.

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 ... on
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:

Code: Select all

class User {
   public int $uid;
   public string $name; 
}

$user = new User();
$user->name = 'Foo';
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
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

Post by Omar_one »

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
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

Post by Denzel »

Omar_one wrote: Fri Nov 03, 2023 7:34 pm more PHP Deprecated

Code: 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
Found this fix for deprecated utf8_encode

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

Post by Omar_one »

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 46
lines 44-49

Code: Select all

// Make sure we use the correct linfeed sequence
      if (EMAIL_LINEFEED == 'CRLF') {
        $this->lf = "\r\n";
      } else {
        $this->lf = "\n";
      }
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: PHP 8.2 - Community Input

Post by ecartz »

OK. Updated mime.php -- see if it works now.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply