Support » Plugin: RecipePress Reloaded » Bug within get_the_rpr_recipe_schema (non-numeric values)

  • Resolved teslina

    (@teslina)


    Hi

    Due to empty values, I’m getting the following error:
    <b>Warning</b>: A non-numeric value encountered in <b>wp-content/plugins/recipepress-reloaded/inc/frontend/class-template.php</b> on line <b>1612</b><br />

    In order to fix this, my suggestion would be to change all lines (where numeric values are expected) within the method get_the_rpr_recipe_schema()

    in File (Starting on line 1557):
    wp-content/plugins/recipepress-reloaded/inc/frontend/class-template.php

    from:

                    $prep_time     = isset( $metadata['rpr_recipe_prep_time'] ) ? $metadata['rpr_recipe_prep_time'] : 0;
                    $cook_time     = isset( $metadata['rpr_recipe_cook_time'] ) ? $metadata['rpr_recipe_cook_time'] : 0;
                    $passive_time  = isset( $metadata['rpr_recipe_passive_time'] ) ? $metadata['rpr_recipe_passive_time'] : 0;
    [...]

    to

                    $prep_time     = !empty( $metadata['rpr_recipe_prep_time'] ) ? (int)$metadata['rpr_recipe_prep_time'] : 0;
                    $cook_time     = !empty( $metadata['rpr_recipe_cook_time'] ) ? (int)$metadata['rpr_recipe_cook_time'] : 0;
                    $passive_time  = !empty( $metadata['rpr_recipe_passive_time'] ) ? (int)$metadata['rpr_recipe_passive_time'] : 0;
    [...]

    Would you agree?
    Thanks for looking into this 🙂

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.