Describe the bug
When triggering a scenario where the _doing_it_wrong function is called we get a fatal error. Here is the error we get:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function _doing_it_wrong(), 2 passed in /home/www/wp-content/plugins/woocommerce-admin/includes/page-controller/class-wc-admin-page-controller.php on line 193 and exactly 3 expected in /home/www/wp-includes/functions.php:4735
Stack trace:
#0 /home/www/wp-content/plugins/woocommerce-admin/includes/page-controller/class-wc-admin-page-controller.php(193): _doing_it_wrong('get_current_pag...', 'Current page re...')
#1 /home/www/wp-content/plugins/woocommerce-admin/includes/page-controller/class-wc-admin-page-controller.php(368): WC_Admin_Page_Controller->get_current_page()
#2 /home/www/wp-content/plugins/woocommerce-admin/includes/page-controller/page-controller-functions.php(49): WC_Admin_Page_Controller->is_registered_page()
#3 /home/www/wp-content/plugins/woocommerce-admin/includes/class-wc-admin-loader.php(342): wc_admin_is_registered_page()
#4 /home/www/ in /home/www/wp-includes/functions.php on line 4735
To Reproduce
I don't have any specific steps to reproduce this, but the user who reported this, mentioned it happened after activating the WooCommerce Social Login plugin: https://woocommerce.com/products/woocommerce-social-login/
Expected behavior
According to the documentation the function should be passing three arguments: https://developer.wordpress.org/reference/functions/_doing_it_wrong/
It seems this function was added to version 0.16: https://github.com/woocommerce/woocommerce-admin/commit/57281970a218ff35e7f8ffb312d20a9c84257ca2
Affected ticket
2240407-zen
We're not using the social login, but we're seeing the same issue. Our error log is full of this stuff.
We see the same issue and we don't have WooCommerce Social Login plugin activated, so it must be unrelated.
@mikkamp Thanks for reporting this. This will be fixed by #2733.
@larssn @nuvoPoint can you provide any additional information so we can hopefully reproduce?
We can fix the missing argument, but something is still triggering the _doing_it_wrong() call.
What versions of WordPress, WooCommerce are you running? What active plugins?
Thank you!
@jeffstieler Thought rrennick already fixed it, but sure, here's most of it (a single site from our multisite):
### WordPress Environment ###
WC Version: 3.6.5
Log Directory Writable: โ
WP Version: 5.2.2
WP Multisite: โ
WP Memory Limit: 256 MB
WP Debug Mode: โ
WP Cron: โ
Language: en_US
External object cache: โ
### Server Environment ###
Server Info: nginx/1.16.0
PHP Version: 7.2.19-0ubuntu0.18.04.1
PHP Post Max Size: 8 MB
PHP Time Limit: 60
PHP Max Input Vars: 1000
cURL Version: 7.58.0
OpenSSL/1.1.1
SUHOSIN Installed: โ
MySQL Version: 8.0.13
Max Upload Size: 1 MB
Default Timezone is UTC: โ
fsockopen/cURL: โ
SoapClient: โ Your server does not have the SoapClient class enabled - some gateway plugins which use SOAP may not work as expected.
DOMDocument: โ
GZip: โ
Multibyte String: โ
Remote Post: โ
Remote Get: โ
### Database ###
WC Database Version: 3.6.5
WC Database Prefix: nuvo_103_
MaxMind GeoIP Database: โ
Total Database Size: 20.62MB
Database Data Size: 16.04MB
Database Index Size: 4.58MB
### Post Type Counts ###
attachment: 55
customize_changeset: 4
jetpack_migration: 2
nav_menu_item: 22
page: 17
people: 25
post: 5
product: 20
revision: 204
scheduled-action: 276
testimonial: 2
### Security ###
Secure connection (HTTPS): โ
Hide errors from visitors: โ
### Active Plugins (11) ###
Gutenberg: by Gutenberg Team โ 6.2.0
Smart Slider 3 Pro: by Nextend โ 3.3.21
Product Open Pricing (Name Your Price) for WooCommerce: by WP Wham โ 1.3.2 โ Not tested with the active version of WooCommerce
PWA: by PWA Plugin Contributors โ 0.2.0
WooCommerce Admin: by WooCommerce โ 0.16.0
WooCommerce Services: by Automattic โ 1.21.0
WooCommerce: by Automattic โ 3.6.5
WP Mail SMTP: by WPForms โ 1.5.2
Jetpack by WordPress.com: by Automattic โ 7.5.3
Yoast SEO: by Team Yoast โ 11.7 โ Not tested with the active version of WooCommerce
User Switching: by John Blackbourn & contributors โ 1.5.1
### Settings ###
API Enabled: โ
Force SSL: โ
Currency: DKK (DKK)
Currency Position: left_space
Thousand Separator: .
Decimal Separator: ,
Number of Decimals: 0
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
variable (variable)
Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)
Connected to WooCommerce.com: โ
### WC Pages ###
Shop base: โ Page not set
Cart: #301 - /cart/
Checkout: #302 - /checkout/
My account: #303 - /my-account/
Terms and conditions: #52 - /terms-and-conditions/
### Templates ###
Overrides: โ
### Action Scheduler ###
Complete: 275
Oldest: 2019-07-21 05:24:17 +0200
Newest: 2019-08-01 16:12:07 +0200
Pending: 1
Oldest: 2019-08-01 17:12:07 +0200
Newest: 2019-08-01 17:12:07 +0200
Canceled: 0
Oldest: โ
Newest: โ
In-progress: 0
Oldest: โ
Newest: โ
Failed: 0
Oldest: โ
Newest: โ
We are running the following:
WordPress: 5.2.2
WooCommerce: 3.6.5
Facebook for WooCommerce: 1.9.15
Jetpack by WordPress.com: 7.5.3
Mailchimp for WooCommerce: 2.1.17
PWA: 0.2.0
Webshipr for WooCommerce: 2.5.4
WooCommerce Admin: 0.16.0
WooCommerce QuickPay: 5.1.2
WooCommerce Sequential Order Numbers Pro: 1.13.1
WooCommerce Services: 1.21.0
WooCommerce Subscriptions: 2.5.7
WP Mail SMTP: 1.5.2
Yoast SEO: 11.7
Stack trace:
0 /var/www/html/wp-content/plugins/woocommerce-admin/includes/page-controller/class-wc-admin-page-controller.php(193): _doing_it_wrong('get_current_pag...', 'Current page re...')
1 /var/www/html/wp-content/plugins/woocommerce-admin/includes/page-controller/class-wc-admin-page-controller.php(368): WC_Admin_Page_Controller->get_current_page()
2 /var/www/html/wp-content/plugins/woocommerce-admin/includes/page-controller/page-controller-functions.php(49): WC_Admin_Page_Controller->is_registered_page()
3 /var/www/html/wp-content/plugins/woocommerce-admin/includes/class-wc-admin-loader.php(342): wc_admin_is_registered_page()
4 /var/www/html/wp-content/plugins/woocommerce-admin/includes/class-wc-admin-loader.php(481): W in /var/www/html/wp-includes/functions.php on line 4735
These look like the common plugins (I didn't match versions):
Activating PWA: by PWA Plugin Contributors triggers this error.
Created an issue with the PWA developers - https://github.com/xwp/pwa-wp/issues/206 .
@rrennick Thank you for your help and research! I have implemented the fix xwp/pwa-wp#207 to see if it fixes the issue. I will give it a couple of hours and report back.
Closing as fixed by #2744 and https://github.com/xwp/pwa-wp/issues/206.
Most helpful comment
Closing as fixed by #2744 and https://github.com/xwp/pwa-wp/issues/206.