Support » Plugin: Letter Avatars » PHP Warning caused by Letter Avatar

  • Resolved Arno Welzel


    I just noticed a bunch of warnings in my server log:

    AH01071: Got error ':  strlen() expects parameter 1 
    to be string, object given in /var/www/clients/client1/web2/web/wp-includes/formatting.php on line 2891

    This only happens on pages with one or more comments. So I checked what is going on and found out, that the cause is a call of is_email() where the first parameter is not a string.

    I found the use of is_email() in letter-avatars/lib/ltrav-frontend.php, line 429:

                    if ( is_email($id_or_email) ) :

    The problem here is, that $id_or_email may not always be a string – and in this case, a warning will be triggered inside is_email() which expects strings.

    I added a check, if $id_or_email is actually a string to avoid these warnings:

                    if ( is_string($id_or_email) && is_email($id_or_email) ) :

    This stopped the warnings. It would be nice to include this change to the next update.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Sibin Grasic


    Hello Arno.

    Thank you so much for this feedback and information, I’ll add the check to the lastest version coming out this week.

    Plugin Author Sibin Grasic


    New version is pushed with the fix in question.

    Thanks again.

    Arno Welzel


    Thanks for the update!

    I came across this bug as well and reached the exact same conclusion, however I only just downloaded the plugin today.

    Looks like something went wrong when committing this fix.

    /trunk/readme.txt has a stable tag 2.7, but /tags/2.7/letter-avatars.php still lists 2.6.2 as current, causing the plugin page to also still display 2.6.2.

    Both /trunk/lib/ltrav-frontend.php and /tags/2.7/lib/ltrav-frontend.php still contain this bug.

    • This reply was modified 11 months, 4 weeks ago by Bart Kuijper. Reason: Corrected file path

    I’ll open another issue for this.

    • This reply was modified 11 months, 4 weeks ago by Arno Welzel.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Warning caused by Letter Avatar’ is closed to new replies.