• Resolved Andrzej Klasén

    (@bibeldans)


    Title: PHP Warning: Undefined array key “value” in lib-widget-fields.php (checkbox widget field)

    Plugin version: 8.8.7

    Environment:

    • PHP 8.3 (CloudLinux Alt-PHP)
    • WordPress (latest)

    Description:

    The checkbox() method in includes/widgets/lib-widget-fields.php (line 85) reads $field['value'] directly without checking whether the key exists:

    php

    protected static function checkbox( $id, $name, $value, $label, $options, $field ) {
        ?>
        <input type="checkbox" ... value="<?php echo esc_attr( $field['value'] ); ?>" <?php checked( $value, $field['value'] ); ?> />

    However, several built-in widgets define checkbox-type fields without setting a 'value' key, e.g.:

    • includes/widgets/popular-listings.php
    • includes/widgets/submit-listing.php
    • includes/widgets/login-form.php
    • includes/widgets/featured-listing.php
    • includes/widgets/all-locations.php

    Whenever one of these widgets is rendered in the WordPress admin (widget editor / Customizer), it throws:

    PHP Warning: Undefined array key "value" in .../includes/widgets/lib-widget-fields.php on line 85

    This occurred 40 times in our error log over roughly a week of normal admin usage.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Mahfuzul Alam

    (@mahfuz87)

    Hello @bibeldans

    Thank you for reaching out.

    We have fixed this issue and included the fix in the latest version of Directorist.

    Please update Directorist to the latest version and let us know your feedback. If the issue still persists after updating, please let us know, and we’ll be happy to investigate further.

    Thank you for your patience and cooperation.

    Kind Regards

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.