Menu

#173 Deprecated call to trim in embedchessboard.php

Fixed
nobody
None
Medium
Task
2022-12-11
2022-12-04
limliga
No

Hi,

On a vanilla Joomla v4.2.5 website with PHP v8.1.13, using the plugin v3.05.00, this PHP warning is displayed:

    Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/customer/www/MYSITE/public_html/plugins/content/embedchessboard/embedchessboard.php on line 169

KR,

Discussion

  • Paolo Casaschi

    Paolo Casaschi - 2022-12-04

    Thanks for opening the ticket.

    It should be straightforward to fix, however I do not have a Joomla installation with PHP 8.

    The warning should disappear by editing the embedchessboard.php file and adding a cast to string in the parameter of the trig function. For example, on line 169 replacing

    $hl_site = trim($this->params->get('horizontalLayout'));
    

    with

    $hl_site = trim((string) $this->params->get('horizontalLayout'));
    

    should eliminate the warning about line 169; however the same warning should apply to line 171 and several after that.

    If you have the ability and the opportunity of testing the code change above, confirming that the warning about line 169 disappears after the change, I'd really appreciate the feedback before I release the update.

    Thanks again for taking the time to open the ticket.

     
  • Paolo Casaschi

    Paolo Casaschi - 2022-12-05

    These functions are all affected by the deprecation:
    addslashes, base64_decode, htmlspecialchars, mb_decode_mimeheader, mysqli_real_escape_string, preg_replace, preg_split, rawurlencode, setcookie, str_starts_with, strcmp, strlen, strtr, strpos, substr, trim, strncasecmp

     
  • Paolo Casaschi

    Paolo Casaschi - 2022-12-06

    I updated the joomla extension to version 3.05.01 with a fix that should eliminate the warning.

    Please check the new version and let me know if there are any further issues or warnings.

     
  • Paolo Casaschi

    Paolo Casaschi - 2022-12-06

    I updated the joomla extension to version 3.05.01 with a fix that should eliminate the warning.

    Please check the new version and let me know if there are any further issues or warnings.

     
  • limliga

    limliga - 2022-12-11

    Hi,

    Apologies for the delay. I confirm that in v3.05.01 the warning is gone.
    Many thanks!

    Regards,

     

Log in to post a comment.