• Hi, after yesterday update my page was broken (error 500 and php error pointed to class file).

    I managed to fix that by adding translation name to lines:

    		$this->avatar_ratings = array(
    			/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
    			'G'  => __( 'G — Suitable for all audiences', ),
    			/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
    			'PG' => __( 'PG — Possibly offensive, usually for audiences 13 and above', ),
    			/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
    			'R'  => __( 'R — Intended for adult audiences above 17', ),
    			/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
    			'X'  => __( 'X — Even more mature than above', ),
    		);

    After that, my website started to work:

    'G'  => __( 'G — Suitable for all audiences', 'simple-local-avatars'),

    Any idea why this throw an error?

    Will you fix it in next update?

    What’s more, error 500 was only on one from two languages on my page using wpml (second language works as usual)

    Best regards, Patrick.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Same here ?

    Plugin Support Darin Kotter

    (@dkotter)

    @patrixer @sekra Thanks for the reports. Can you let me know which version of Simple Local Avatars you had issues with? I believe this issue should have been fixed in the last release, v2.7.3, so just want to verify what version you’re having this problem in. Thanks!

    Hey @dkotter , thank you for addressing this issue. As @patrixer mentioned, the problem is originated by the missing domain for the gettext function __().

    I’m using version 2.7.3 and there is still and issue. I had to edit the main plugin file (what I normally not do!) to get rid of this.

    The file that the error occurs is /wp-content/plugins/simple-local-avatars/includes/class-simple-local-avatars.php lines 527 – 533

    Just add the domain to the __() function and it should be fixed.

    Thank you, greetings from Germany ??

    Sebastian

    Plugin Support Darin Kotter

    (@dkotter)

    @sekra Thanks for the followup. Do you happen to know what error message you were getting without that in place? We removed our custom textdomain from those strings since these are translated by WordPress itself. But if that’s causing errors, we’ll obviously need to fix this up.

    Plugin Support Darin Kotter

    (@dkotter)

    And I guess one followup, which version of PHP are you running?

    Hey @dkotter , thank you for following up. I just realized the bug is simple ?? The domain has been removed but not the comma “,” after the string you want to translate. So simple remove the commas after the translation string.

    // Just change this
    'G'  => __( 'G — Suitable for all audiences', )
    
    // to this
    'G'  => __( 'G — Suitable for all audiences' )

    Simply remove the commas after the translation strings and the error will be gone. Please note there are 4 occurrences in your code. For G, PG, R and X.

    Hope that helps ??

    Best, Sebastian

    • This reply was modified 2 years, 1 month ago by SeKra.

    PHP version 8.1.14 ??

    Plugin Support Darin Kotter

    (@dkotter)

    Thanks for the help! I had saw that myself but I thought trailing commas only caused issues in PHP 7.2 or less and our minimum is PHP 7.4. But if you’re having issues while running PHP 8.1, seems this is a bigger issue that we should fix.

    Do you have a GitHub username that we can give props to for this? Or feel free to open a PR (https://github.com/10up/simple-local-avatars/pulls) if you want, otherwise I can look to take care of that in the next day or two

    Thread Starter Patrixer

    (@patrixer)

    Hello @dkotter

    Thank you for your answer! However it can be something else – I’m using PHP 7.4.33 and 2.7.3 plugin version, however I didn’t try to remove comma. I will let you know, but it will probably also fix this issue

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Php Error after update’ is closed to new replies.