• Resolved mattnealstafflink

    (@mattnealstafflink)


    Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in wp-includes/formatting.php on line 4715

    While this is technically an issue with WordPress not being fully compatible with WordPress, there are no checks in this plugin for null strings in the multi-card-template.partial.php file. I assume it’s the same problem with the other template too.

    It makes sense to check if they aren’t null first, so for a quick fix, you could just add a non coalescing echo.

    <?php echo ( $review->ReviewerName ) ? esc_textarea( $review->ReviewerName) : ''; ?>
    
    <?php echo ( $review->ReviewerType ) ? '(' . esc_textarea( $review->ReviewerType) . ')' : ''; ?>

    Cheers.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mattnealstafflink

    (@mattnealstafflink)

    Also, in ReviewCarouselShortcode.php, the $data array receives a null variable in the str_replace() function in the third option ($attrs['heading']). If there is no heading, the plugin doesn’t check for empty. The easiest solution is the same as above, make it null coalescing:

    $attrs['heading'] ?? ''

    And in context:

    $data = [
    
    'carousel_id' => TemplateHelpers::generate_id(6, 'rma-review-'),
    
    'classname' => isset($attributes['classname']) ? $attributes['classname'] : '',
    
    'heading' => str_replace("{reviewCount}", $profile->ReviewCount, $attrs['heading'] ?? ''),
    
    'is_agency' => $is_agency,
    
    'profile_url' => $is_agency ? $profile->RmaAgencyProfileUrl : $profile->RmaAgentProfileUrl,
    
    'reviews' => $reviews,
    
    'rma_url' => UrlHelpers::get_rma_url(),
    
    'show_img' => in_array($attrs['template_type'], ['full', 'no-avatar']),
    
    'hide_agent_details' => in_array($attrs['template_type'], ['no-avatar']),
    
    ];

    Null Coalescing was introduced in PHP 7.0, so it won’t work with older sites, but the plugin is listed as PHP@7.4 or higher so that shouldn’t matter.

    Plugin Author ratemyagent

    (@ratemyagent)

    I am currently on leave by will look into this when i return next week

    Thread Starter mattnealstafflink

    (@mattnealstafflink)

    No worries @ratemyagent , I’m happy to create pull requests/suggestions if you have the plugin somewhere public in Git.

    Plugin Author ratemyagent

    (@ratemyagent)

    This should be fixed in the 1.3.0 release

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

The topic ‘PHP 8.2 Compatability: htmlspecialchars()’ is closed to new replies.