Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PHP Deprecated messages #526

Open
2 tasks done
PHP8Coder opened this issue Oct 22, 2023 · 5 comments
Open
2 tasks done

Fix PHP Deprecated messages #526

PHP8Coder opened this issue Oct 22, 2023 · 5 comments

Comments

@PHP8Coder
Copy link

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the plugin and it is still present.

WordPress version

6.3.2

Cloudflare-WordPress version

4.12.2

PHP version

8.2.11

Expected result

No messages

Actual result

PHP Deprecated: Creation of dynamic property CF\WordPress\Proxy::$pluginAPI is deprecated in ***/wp-content/plugins/cloudflare/src/WordPress/Proxy.php on line 31

PHP Deprecated: Creation of dynamic property CF\WordPress\DataStore::$logger is deprecated in ***/wp-content/plugins/cloudflare/src/WordPress/DataStore.php on line 23

Steps to reproduce

Activate Debug logging

Additional factoids

How to fix:

class DataStore {
    public $logger;
    // ... rest of the class
}

namespace CF\WordPress;

use CF\Integration\DefaultLogger;
use CF\Integration\DataStoreInterface;
use CF\API\Plugin;
use Symfony\Polyfill\Tests\Intl\Idn;

class DataStore implements DataStoreInterface
{
    const API_KEY = 'cloudflare_api_key';
    const EMAIL = 'cloudflare_api_email';
    const CACHED_DOMAIN_NAME = 'cloudflare_cached_domain_name';

    protected $wordPressWrapper;
    protected $logger;  // <-- Add this line here

    /**
     * @param DefaultLogger $logger
     */
    public function __construct(DefaultLogger $logger)
    {
        $this->logger = $logger;
        $this->wordPressWrapper = new WordPressWrapper();
    }

    // ... rest of the class
}

namespace CF\WordPress;

use CF\API;
use CF\API\Plugin;
use CF\Integration\IntegrationInterface;
use CF\Router\RequestRouter;

class Proxy
{
    protected $config;
    protected $dataStore;
    protected $logger;
    protected $wordpressAPI;
    protected $wordpressClientAPI;
    protected $wordpressIntegration;
    protected $requestRouter;
    protected $pluginAPI;  // <-- Add this line here

    /**
     * @param IntegrationInterface $integration
     */
    public function __construct(IntegrationInterface $integration)
    {
        // ... rest of the constructor
    }

    // ... rest of the class
}

References

No response

@knofte
Copy link

knofte commented Nov 29, 2023

@PHP8Coder
protected $logger;
or
public though?
Or either would be a safe one? (asking because I don't know)

@gosixl
Copy link

gosixl commented Jan 8, 2024

Please

@juhojama
Copy link

Same

Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jul 16, 2024
@knofte
Copy link

knofte commented Jul 16, 2024

bump

@github-actions github-actions bot removed the Stale label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@knofte @juhojama @gosixl @PHP8Coder and others