Automattic / woocommerce-services

WooCommerce Services is a feature plugin that integrates hosted services into WooCommerce (3.0+), and currently includes automated tax rates and the ability to purchase and print USPS shipping labels.
GNU General Public License v2.0
108 stars 20 forks source link

PHP Fatal Error: Cannot call constructor in woocommerce-services/2.4.2/classes/wc-api-dev/class-wc-rest-dev-data-continents-controller.php #2714

Closed mdbitz closed 9 months ago

mdbitz commented 9 months ago

On the WP.cloud platform we are seeing fatal errors caused by woocommerce-services 24.2

PHP Fatal error:  Uncaught Error: Cannot call constructor in /wordpress/plugins/woocommerce-services/2.4.2/classes/wc-api-dev/class-wc-rest-dev-data-continents-controller.php:47
Stack trace:
#0 /wordpress/plugins/woocommerce-services/2.4.2/woocommerce-services.php(987): WC_REST_Dev_Data_Continents_Controller->__construct()
#1 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(324): WC_Connect_Loader->wc_api_dev_init(Object(WP_REST_Server))
#2 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#3 /wordpress/core/6.4.3/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#4 /wordpress/core/6.4.3/wp-includes/rest-api.php(593): do_action('rest_api_init', Object(WP_REST_Server))
#5 /wordpress/core/6.4.3/wp-includes/rest-api.php(125): rest_get_server()
#6 /srv/htdocs/wp-content/plugins/vision/includes/plugin.php(69): register_rest_route('vision/v1', '/item/(?P<id>\\d...', Array)
#7 /srv/htdocs/wp-content/plugins/vision/vision.php(71): Vision_Builder->run()
#8 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(324): vision_run('')
#9 /wordpress/core/6.4.3/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#10 /wordpress/core/6.4.3/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#11 /wordpress/core/6.4.3/wp-settings.php(643): do_action('init')
#12 /srv/htdocs/wp-config.php(74): require_once('/wordpress/core...')
#13 /wordpress/core/6.4.3/wp-load.php(55): require_once('/srv/htdocs/wp-...')
#14 /wordpress/core/6.4.3/wp-blog-header.php(13): require_once('/wordpress/core...')
#15 /wordpress/core/6.4.3/index.php(17): require('/wordpress/core...')
#16 {main}
  thrown in /wordpress/plugins/woocommerce-services/2.4.2/classes/wc-api-dev/class-wc-rest-dev-data-continents-controller.php on line 47

Upon review I'm showing that the WC_REST_Dev_Data_Continents_Controller class is attempting to call construct on a parent class that does not define a construct method.

PHP classes don't have default constructors, as such the call to parent::__construct needs to be removed.