10up / distributor

Share content between your websites.
https://distributorplugin.com
GNU General Public License v2.0
618 stars 156 forks source link

[PHP8.2+] Creation of dynamic property Distributor\Authentications\WordPressBasicAuth::x is deprecated while adding external connection #1229

Open kirtangajjar opened 1 month ago

kirtangajjar commented 1 month ago

Describe the bug

We get the following deprecation warning while adding a new external connection:

[16-Jun-2024 12:23:10 UTC] PHP Deprecated:  Creation of dynamic property Distributor\Authentications\WordPressBasicAuth::$username is deprecated in /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentication.php on line 36
[16-Jun-2024 12:23:10 UTC] PHP Stack trace:
[16-Jun-2024 12:23:10 UTC] PHP   1. {main}() /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:0
[16-Jun-2024 12:23:10 UTC] PHP   2. do_action($hook_name = 'wp_ajax_dt_verify_external_connection') /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:192
[16-Jun-2024 12:23:10 UTC] PHP   3. WP_Hook->do_action($args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/plugin.php:517
[16-Jun-2024 12:23:10 UTC] PHP   4. WP_Hook->apply_filters($value = '', $args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:348
[16-Jun-2024 12:23:10 UTC] PHP   5. Distributor\ExternalConnectionCPT\ajax_verify_external_connection('') /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:324
[16-Jun-2024 12:23:10 UTC] PHP   6. Distributor\Authentications\WordPressBasicAuth->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/external-connection-cpt.php:256
[16-Jun-2024 12:23:10 UTC] PHP   7. Distributor\Authentication->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentications/WordPressBasicAuth.php:43
[16-Jun-2024 12:23:10 UTC] PHP Deprecated:  Creation of dynamic property Distributor\Authentications\WordPressBasicAuth::$password is deprecated in /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentication.php on line 36
[16-Jun-2024 12:23:10 UTC] PHP Stack trace:
[16-Jun-2024 12:23:10 UTC] PHP   1. {main}() /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:0
[16-Jun-2024 12:23:10 UTC] PHP   2. do_action($hook_name = 'wp_ajax_dt_verify_external_connection') /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:192
[16-Jun-2024 12:23:10 UTC] PHP   3. WP_Hook->do_action($args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/plugin.php:517
[16-Jun-2024 12:23:10 UTC] PHP   4. WP_Hook->apply_filters($value = '', $args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:348
[16-Jun-2024 12:23:10 UTC] PHP   5. Distributor\ExternalConnectionCPT\ajax_verify_external_connection('') /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:324
[16-Jun-2024 12:23:10 UTC] PHP   6. Distributor\Authentications\WordPressBasicAuth->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/external-connection-cpt.php:256
[16-Jun-2024 12:23:10 UTC] PHP   7. Distributor\Authentication->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentications/WordPressBasicAuth.php:43
[16-Jun-2024 12:23:10 UTC] PHP Deprecated:  Creation of dynamic property Distributor\Authentications\WordPressBasicAuth::$client_id is deprecated in /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentication.php on line 36
[16-Jun-2024 12:23:10 UTC] PHP Stack trace:
[16-Jun-2024 12:23:10 UTC] PHP   1. {main}() /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:0
[16-Jun-2024 12:23:10 UTC] PHP   2. do_action($hook_name = 'wp_ajax_dt_verify_external_connection') /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:192
[16-Jun-2024 12:23:10 UTC] PHP   3. WP_Hook->do_action($args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/plugin.php:517
[16-Jun-2024 12:23:10 UTC] PHP   4. WP_Hook->apply_filters($value = '', $args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:348
[16-Jun-2024 12:23:10 UTC] PHP   5. Distributor\ExternalConnectionCPT\ajax_verify_external_connection('') /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:324
[16-Jun-2024 12:23:10 UTC] PHP   6. Distributor\Authentications\WordPressBasicAuth->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/external-connection-cpt.php:256
[16-Jun-2024 12:23:10 UTC] PHP   7. Distributor\Authentication->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentications/WordPressBasicAuth.php:43
[16-Jun-2024 12:23:10 UTC] PHP Deprecated:  Creation of dynamic property Distributor\Authentications\WordPressBasicAuth::$client_secret is deprecated in /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentication.php on line 36
[16-Jun-2024 12:23:10 UTC] PHP Stack trace:
[16-Jun-2024 12:23:10 UTC] PHP   1. {main}() /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:0
[16-Jun-2024 12:23:10 UTC] PHP   2. do_action($hook_name = 'wp_ajax_dt_verify_external_connection') /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:192
[16-Jun-2024 12:23:10 UTC] PHP   3. WP_Hook->do_action($args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/plugin.php:517
[16-Jun-2024 12:23:10 UTC] PHP   4. WP_Hook->apply_filters($value = '', $args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:348
[16-Jun-2024 12:23:10 UTC] PHP   5. Distributor\ExternalConnectionCPT\ajax_verify_external_connection('') /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:324
[16-Jun-2024 12:23:10 UTC] PHP   6. Distributor\Authentications\WordPressBasicAuth->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/external-connection-cpt.php:256
[16-Jun-2024 12:23:10 UTC] PHP   7. Distributor\Authentication->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentications/WordPressBasicAuth.php:43
[16-Jun-2024 12:23:10 UTC] PHP Deprecated:  Creation of dynamic property Distributor\Authentications\WordPressBasicAuth::$redirect_uri is deprecated in /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentication.php on line 36
[16-Jun-2024 12:23:10 UTC] PHP Stack trace:
[16-Jun-2024 12:23:10 UTC] PHP   1. {main}() /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:0
[16-Jun-2024 12:23:10 UTC] PHP   2. do_action($hook_name = 'wp_ajax_dt_verify_external_connection') /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:192
[16-Jun-2024 12:23:10 UTC] PHP   3. WP_Hook->do_action($args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/plugin.php:517
[16-Jun-2024 12:23:10 UTC] PHP   4. WP_Hook->apply_filters($value = '', $args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:348
[16-Jun-2024 12:23:10 UTC] PHP   5. Distributor\ExternalConnectionCPT\ajax_verify_external_connection('') /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:324
[16-Jun-2024 12:23:10 UTC] PHP   6. Distributor\Authentications\WordPressBasicAuth->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/external-connection-cpt.php:256
[16-Jun-2024 12:23:10 UTC] PHP   7. Distributor\Authentication->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentications/WordPressBasicAuth.php:43
[16-Jun-2024 12:23:10 UTC] PHP Deprecated:  Creation of dynamic property Distributor\Authentications\WordPressBasicAuth::$base64_encoded is deprecated in /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/classes/Authentications/WordPressBasicAuth.php on line 46
[16-Jun-2024 12:23:10 UTC] PHP Stack trace:
[16-Jun-2024 12:23:10 UTC] PHP   1. {main}() /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:0
[16-Jun-2024 12:23:10 UTC] PHP   2. do_action($hook_name = 'wp_ajax_dt_verify_external_connection') /Users/kirtangajjar/code/osp-mu/app/public/wp-admin/admin-ajax.php:192
[16-Jun-2024 12:23:10 UTC] PHP   3. WP_Hook->do_action($args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/plugin.php:517
[16-Jun-2024 12:23:10 UTC] PHP   4. WP_Hook->apply_filters($value = '', $args = [0 => '']) /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:348
[16-Jun-2024 12:23:10 UTC] PHP   5. Distributor\ExternalConnectionCPT\ajax_verify_external_connection('') /Users/kirtangajjar/code/osp-mu/app/public/wp-includes/class-wp-hook.php:324
[16-Jun-2024 12:23:10 UTC] PHP   6. Distributor\Authentications\WordPressBasicAuth->__construct($args = ['username' => 'admin', 'password' => 'zDMC 1R7i drKr f38O h7ok XXfT', 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'http://osp-mu.test/wp-admin/post-new.php?post_type=dt_ext_connection&setupStatus=success&titleField=single&externalSiteUrlField=http3A2F2Fosp.test2F&restRoot=http3A2F2Fosp.test2Fwp-json2F&site_url=httposp.test&user_login=admin&password=zDMC1R7idrKrf38Oh7okXXfT']) /Users/kirtangajjar/code/osp-mu/app/public/wp-content/plugins/distributor/includes/external-connection-cpt.php:256
[16-Jun-2024 12:23:10 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: ::1:9003 (from HTTP_X_FORWARDED_FOR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[16-Jun-2024 12:23:10 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: ::1:9003 (from HTTP_X_FORWARDED_FOR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).
[16-Jun-2024 12:23:10 UTC] Xdebug: [Step Debug] Could not connect to debugging client. Tried: ::1:9003 (from HTTP_X_FORWARDED_FOR HTTP header), localhost:9003 (fallback through xdebug.client_host/xdebug.client_port).

Steps to Reproduce

  1. Create a site with PHP 8.2+
  2. Create an external connection
  3. See the warning in debug logs

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct