Title: PHP 8.1 issue &#8211; Optional parameter declared before required parame
Last modified: October 10, 2025

---

# PHP 8.1 issue – Optional parameter declared before required parame

 *  Resolved [daymobrew](https://wordpress.org/support/users/daymobrew/)
 * (@daymobrew)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/)
 * I am running WordPress 6.8.3, WooCommerce 10.2.2, WooCommerce Square 5.1.0 on
   PHP 8.1.33 and I get the following PHP deprecation warning:
 * `PHP Deprecated: Optional parameter $location_ids declared before required parameter
   $start_time is implicitly treated as a required parameter in /wp-content/plugins/
   woocommerce-square/includes/Gateway/API.php on line 734`
 * The line is:
 * `public function search_orders( $location_ids = array(), $start_time, $limit 
   = 100, $cursor = '', $end_time = '' )`
 * $start_time should have a default value or moved in front of $location_ids.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [shahzeen(woo-hc)](https://wordpress.org/support/users/shahzeenfarooq/)
 * (@shahzeenfarooq)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/#post-18676145)
 * Hi there!
 * Thank you for sharing the details. I’ve activated the same plugin on my site 
   but wasn’t able to replicate the issue on my end.
 * For testing purposes, could you please try changing your PHP version to **8.3**
   and see if you still experience the same issue?
 * Also, I’d like to understand your site properly. Please share with us the necessary
   information below for us to investigate the issue further:
    - **System Status Report** which you can find via WooCommerce > Status
    - **Fatal error logs** (if any) under WooCommerce > Status > Logs.
 * Please use [https://pastebin.com/](https://pastebin.com/) or [https://gist.github.com/](https://gist.github.com/)
   and share a link to that paste in reply here. Once we have more information, 
   we’ll be able to assist you further.
 *  Thread Starter [daymobrew](https://wordpress.org/support/users/daymobrew/)
 * (@daymobrew)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/#post-18676173)
 * I switched to PHP 8.3 and the warning is there when I log into the admin area.
 * [System Status Report](https://gist.github.com/damiencarbery/3141f261978f40ed810e51563e0f21de#file-woocommerce-status-txt)
 * There are no fatal logs.
 *  Plugin Support [shahzeen(woo-hc)](https://wordpress.org/support/users/shahzeenfarooq/)
 * (@shahzeenfarooq)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/#post-18676204)
 * **Hi there!**
 * Thank you for sharing the system status report. I’ve tried to replicate the issue
   on my end but wasn’t able to see that warning on my site, although the same code
   also exists in the Square plugin I’m using.
 * For testing purposes, could you please create a staging site, deactivate all 
   plugins except WooCommerce, then reinstall the Square plugin and check if you
   still see the warning?
 * I’ve tested this on two different sites but wasn’t able to replicate the issue.
 *  Thread Starter [daymobrew](https://wordpress.org/support/users/daymobrew/)
 * (@daymobrew)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/#post-18678612)
 * I have set up a staging site and it only has WordPress 6.8.3, WooCommerce 10.2.2
   and WooCommerce Square 5.1.0.
 * I get the same warnings:
 * `[13-Oct-2025 09:05:13 UTC] PHP Deprecated: Optional parameter $location_ids 
   declared before required parameter $start_time is implicitly treated as a required
   parameter in /wp-content/plugins/woocommerce-square/includes/Gateway/API.php 
   on line 734`
 * I don’t know why you do not see it but it is a [deprecation since 8.0.0](https://php.watch/versions/8.0/deprecate-required-param-after-optional).
 * See [Example 6 that covers this](https://www.php.net/manual/en/functions.arguments.php#functions.arguments.default).
 *  Plugin Support [shahzeen(woo-hc)](https://wordpress.org/support/users/shahzeenfarooq/)
 * (@shahzeenfarooq)
 * [6 months, 3 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/#post-18682119)
 * Hi there!
 * Thank you for confirming and sharing the details. It appears that this is indeed
   a **bug**. Our developers are already aware of it, and a **fix is being tested
   in the next release** — you can follow the progress here:
   👉 [https://github.com/woocommerce/woocommerce-square/pull/413](https://github.com/woocommerce/woocommerce-square/pull/413)
 * For now, the notice is only a **PHP deprecation warning** and does not affect
   your store’s functionality. The update including the fix should be available 
   soon.
 *  Plugin Support [Chris Moreira – a11n](https://wordpress.org/support/users/chrism245/)
 * (@chrism245)
 * [6 months, 2 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/#post-18691434)
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved–
   we’ll be here if and/or when you are ready to continue.
 * If you have a few minutes, we’d love if you could leave us a review: [https://wordpress.org/support/plugin/woocommerce-square/reviews/](https://wordpress.org/support/plugin/woocommerce-square/reviews/)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘PHP 8.1 issue – Optional parameter declared before required parame’ is
closed to new replies.

 * ![](https://ps.w.org/woocommerce-square/assets/icon-256x256.png?rev=3234354)
 * [WooCommerce Square](https://wordpress.org/plugins/woocommerce-square/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce-square/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce-square/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce-square/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce-square/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce-square/reviews/)

 * 6 replies
 * 3 participants
 * Last reply from: [Chris Moreira – a11n](https://wordpress.org/support/users/chrism245/)
 * Last activity: [6 months, 2 weeks ago](https://wordpress.org/support/topic/php-8-1-issue-optional-parameter-declared-before-required-parame/#post-18691434)
 * Status: resolved