mcguffin / acf-openstreetmap-field

WordPress ACF Field for OpenStreetMap
https://wordpress.org/plugins/acf-openstreetmap-field/
GNU General Public License v3.0
107 stars 21 forks source link

changed function visibility to prevent error in wp #79

Closed georgos-g closed 2 years ago

georgos-g commented 2 years ago

changed _clone () function visibility to public to prevent error messages in wordpress admin after update to php 8

joostdekeijzer commented 2 years ago

I'm getting the same error on the __wakeup() function:

[24-Mar-2022 09:30:35 UTC] PHP Warning: The magic method ACFFieldOpenstreetmap\Core\Singleton::__wakeup() must have public visibility in /public_html/wp-content/plugins/acf-openstreetmap-field/include/ACFFieldOpenstreetmap/Core/Singleton.php on line 52

https://daylerees.com/php-patterns-singleton/ suggests using the following:

    /**
     * Disable the cloning of this class.
     * 
     * @return void
     */
    final public function __clone()
    {
        throw new Exception('Feature disabled.');
    }

    /**
     * Disable the wakeup of this class.
     * 
     * @return void
     */
    final public function __wakeup()
    {
        throw new Exception('Feature disabled.');
    }
joostdekeijzer commented 2 years ago

I'm getting the same error on the __wakeup() function:

[24-Mar-2022 09:30:35 UTC] PHP Warning: The magic method ACFFieldOpenstreetmap\Core\Singleton::__wakeup() must have public visibility in /public_html/wp-content/plugins/acf-openstreetmap-field/include/ACFFieldOpenstreetmap/Core/Singleton.php on line 52

https://daylerees.com/php-patterns-singleton/ suggests using the following:

    /**
     * Disable the cloning of this class.
     * 
     * @return void
     */
    final public function __clone()
    {
        throw new Exception('Feature disabled.');
    }

    /**
     * Disable the wakeup of this class.
     * 
     * @return void
     */
    final public function __wakeup()
    {
        throw new Exception('Feature disabled.');
    }