wpexplorer / wpex-blogger

Blogger Free WordPress Theme
GNU General Public License v2.0
6 stars 1 forks source link

Fix for php 8.2 Creation of dynamic property Error #10

Closed Kvarkas closed 4 months ago

Kvarkas commented 4 months ago

In PHP 8.2 and later, attempting to create dynamic properties on objects directly like this:

$obj->newProperty = ‘value’;

Here is an Error exception:

Uncaught Error: Creation of dynamic property App\MyClass::$newProperty is not allowed

This change was introduced as a security and performance enhancement in PHP 8.2. However, it can break plugins that rely on dynamic property creation.

To fix just need declare it as a class property first:

class WPEX_Theme_Admin_About {

    /**
     * Get things started
     *
     * @since 1.0
     */
    public $info;

fix for https://github.com/wpexplorer/wpex-blogger/issues/9

wpexplorer commented 4 months ago

@Kvarkas - Looks like I hadn't updated this repo with the 2.2.2 version which I do have for download on our website. I just pushed it out!