[wp-trac] [WordPress Trac] #63794: PHP notice: Array to string conversion in general-template.php

WordPress Trac noreply at wordpress.org
Thu Aug 7 16:47:13 UTC 2025


#63794: PHP notice: Array to string conversion in general-template.php
--------------------------+----------------------
 Reporter:  balvantk      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  General       |     Version:  6.8.2
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by sabernhardt):

 * milestone:  Awaiting Review =>


Old description:

> Test Case: PHP Notice - Array to String Conversion with Multiple Coupons
>
> Environment:
>     Cart/Checkout: Classic and Block tested
>     WooCommerce version: (assumed to be recent, e.g., 9.x)
>

> | Step No. | Action                                             |
> Expected Result
> |
> | -------- | -------------------------------------------------- |
> ------------------------------------------------------------------------------------------------------
> |
> | 1        | Login as a registered user.                        | Login
> successful
> |
> | 2        | Add a product to the cart.                         | Product
> is added successfully
> |
> | 3        | Go to the **Cart page**.                           | Both
> coupons are auto/applied manually and reflected correctly
> |
> | 4        | Proceed to **Checkout** and place the order.       | Order
> is placed successfully
> |
> | 5        | Check the **debug.log** (or other PHP error logs). | ❌
> **PHP Notice:** `Array to string conversion` appears if improper coupon
> formatting or output exists. |
>

> This error show in log file
> [07-Aug-2025 05:33:32 UTC] $helper: free_gift
> [07-Aug-2025 05:33:32 UTC] $current: smart_coupon
> [07-Aug-2025 05:33:32 UTC] $helper: smart_coupon
> [07-Aug-2025 05:33:32 UTC] $current: smart_coupon
> [07-Aug-2025 05:33:32 UTC] $helper: no
> [07-Aug-2025 05:33:32 UTC] $current: yes
> [07-Aug-2025 05:33:32 UTC] $helper: Array
> (
>     [0] =>
> )
>
> [07-Aug-2025 05:33:32 UTC] $current: yes
> **[07-Aug-2025 05:33:32 UTC] PHP Notice:  Array to string conversion in
> C:\laragon\www\StoreApps\wp-includes\general-template.php on line 5313**
> [07-Aug-2025 05:33:32 UTC] $helper: no
> [07-Aug-2025 05:33:32 UTC] $current: yes
> [07-Aug-2025 05:33:32 UTC] $helper: no
> [07-Aug-2025 05:33:32 UTC] $current: yes

New description:

 Test Case: PHP Notice - Array to String Conversion with Multiple Coupons

 Environment:
 - Cart/Checkout: Classic and Block tested
 - WooCommerce version: (assumed to be recent, e.g., 9.x)


 ||= Step No. =||= Action                                           =||=
 Expected Result
 =||
 || 1          || Login as a registered user.                        ||
 Login successful
 ||
 || 2          || Add a product to the cart.                         ||
 Product is added successfully
 ||
 || 3          || Go to the **Cart page**.                           ||
 Both coupons are auto/applied manually and reflected correctly
 ||
 || 4          || Proceed to **Checkout** and place the order.       ||
 Order is placed successfully
 ||
 || 5          || Check the **debug.log** (or other PHP error logs). || ❌
 **PHP Notice:** `Array to string conversion` appears if improper coupon
 formatting or output exists. ||


 This error show in log file
 {{{
 [07-Aug-2025 05:33:32 UTC] $helper: free_gift
 [07-Aug-2025 05:33:32 UTC] $current: smart_coupon
 [07-Aug-2025 05:33:32 UTC] $helper: smart_coupon
 [07-Aug-2025 05:33:32 UTC] $current: smart_coupon
 [07-Aug-2025 05:33:32 UTC] $helper: no
 [07-Aug-2025 05:33:32 UTC] $current: yes
 [07-Aug-2025 05:33:32 UTC] $helper: Array
 (
     [0] =>
 )

 [07-Aug-2025 05:33:32 UTC] $current: yes
 **[07-Aug-2025 05:33:32 UTC] PHP Notice:  Array to string conversion in
 C:\laragon\www\StoreApps\wp-includes\general-template.php on line 5313**
 [07-Aug-2025 05:33:32 UTC] $helper: no
 [07-Aug-2025 05:33:32 UTC] $current: yes
 [07-Aug-2025 05:33:32 UTC] $helper: no
 [07-Aug-2025 05:33:32 UTC] $current: yes
 }}}

--

Comment:

 I think fix-array-conversion.patch was supposed to add the two lines, not
 remove them.

 However, I agree that the WooCommerce support forum should be a better
 place to discuss this (at least for now).

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63794#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list