Title: PHP error &#8211; handle variations
Last modified: February 8, 2024

---

# PHP error – handle variations

 *  Resolved [enomoto celtislab](https://wordpress.org/support/users/enomoto-celtislab/)
 * (@enomoto-celtislab)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-error-handle-variations/)
 * When variation groups are not used.
 * $variations_groups = filter_input( INPUT_POST, ‘asp-variations-group-names’, 
   FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY );
 * The value obtained in $variations_groups is an empty array as shown below.
 * `array(1) (
   [0] = (string))
 * This has been determined to have a variation group.
 * Then I get a PHP error.
 * **Fatal error**: Uncaught Error: array_values(): Argument #1 ($array) must be
   of type array, null given
   in **C:\xampp82\htdocs\wordpress\wp-content\plugins\
   stripe-payments\admin\includes\class-asp-admin-product-meta-boxes.php** on line**
   1057**
 * Call stack:
    1. `array_values()`
       wp-content/plugins/stripe-payments/admin/includes/class-asp-
       admin-product-meta-boxes.php:1057
    2. `ASP_Admin_Product_Meta_Boxes::save_product_handler()`
       wp-includes/class-wp-
       hook.php:324
    3. `WP_Hook::apply_filters()`
       wp-includes/class-wp-hook.php:348
    4. `WP_Hook::do_action()`
       wp-includes/plugin.php:517
    5. `do_action()`
       wp-includes/post.php:4749
    6. `wp_insert_post()`
       wp-includes/post.php:4862
    7. `wp_update_post()`
       wp-admin/includes/post.php:453
    8. `edit_post()`
       wp-admin/post.php:227

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

 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17411409)
 * Thank you for reaching out to us. Let me see if I understand your issue. You 
   are saying that when you create a new product and you don’t enable **_Use variations
   only to construct final product price_** you see the error you mention above.
   Is this correct?
 * Kind regards.
 *  Thread Starter [enomoto celtislab](https://wordpress.org/support/users/enomoto-celtislab/)
 * (@enomoto-celtislab)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17411967)
 * yes
   I don’t use variations when saving products. However, PHP program processing
   determines that it is being used. This will do the wrong thing and cause a PHP
   error
 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17413935)
 * Thank you for sharing more information. I have submitted a message to the developers
   to investigate further your findings.
 * Kind regards.
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17420609)
 * Thank you. I will check this out.
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17488146)
 * We have released an update that should solve this.
 *  Thread Starter [enomoto celtislab](https://wordpress.org/support/users/enomoto-celtislab/)
 * (@enomoto-celtislab)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17489712)
 * Not resolved.
 * Normally, there seems to be no problem, but the problem may occur after some 
   processing (I don’t know what I did)
 * **stripe-payments\admin\includes\class-asp-admin-product-meta-boxes.php** on 
   line **1058-**
 * `$variations_groups = filter_input( INPUT_POST, 'asp-variations-group-names',
   FILTER_UNSAFE_RAW, FILTER_REQUIRE_ARRAY );
   // if ( ! empty( $variations_groups)&&
   is_array( $variations_groups ) ) {if ( ! empty( $variations_groups ) && is_array(
   $variations_groups ) && **! empty( $variations_groups[0] )** ) {
 * I think you normally expect $variations_groups to be null when you’re not using
   variations, but sometimes with array types the first array element is an empty
   string.
 * If you add one judgment condition: **! empty( $variations_groups[0] )**, no errors
   will occur even in irregular cases like this
 *  Plugin Author [mra13 / Team Tips and Tricks HQ](https://wordpress.org/support/users/mra13/)
 * (@mra13)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17507239)
 * Thank you. We will try to add something for this condition in the next release
   again.
 *  Plugin Support [mbrsolution](https://wordpress.org/support/users/mbrsolution/)
 * (@mbrsolution)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17543645)
 * We have released a new version with a patch for your issue. Can you check to 
   see if this version fixes your issue.
 * Thank you.
 *  Thread Starter [enomoto celtislab](https://wordpress.org/support/users/enomoto-celtislab/)
 * (@enomoto-celtislab)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17543934)
 * The error can no longer be reproduce.
 * My guess is that when the error occurred, asp_variations_names was undefined,
   so filter_input () became null.
   After that, when I corrected the code and executed
   it to check the operation, update_post_meta( $post_id, ‘asp_variations_names’,
   false ); was executed, the undefined was resolved, and the error no longer occurred.
 * However, if you click the Create Group button in variations and update the Edit
   Product without creating a variation, an empty variation will be created.
 * When you Pay Now for this item, an empty dropdown select for variation selection
   will appear at the top of the purchase dialog.
 * Is this the expected behavior?
 * After all, wouldn’t it be better to add one more judgment condition **? empty(
   $variations_groups[0] ),**
 * For now, I think the error no longer occurs during normal use, so I’ll mark it
   as resolved.

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

The topic ‘PHP error – handle variations’ is closed to new replies.

 * ![](https://ps.w.org/stripe-payments/assets/icon-128x128.png?rev=2705524)
 * [Accept Stripe Payments](https://wordpress.org/plugins/stripe-payments/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/stripe-payments/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/stripe-payments/)
 * [Active Topics](https://wordpress.org/support/plugin/stripe-payments/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/stripe-payments/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/stripe-payments/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [enomoto celtislab](https://wordpress.org/support/users/enomoto-celtislab/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/php-error-handle-variations/#post-17543934)
 * Status: resolved