Support » Plugin: WP REST Yoast Meta » Getting 500 Internal server erro

  • Resolved jhaankitesh


    [Thu Nov 28 08:39:48.804112 2019] [:error] [pid 32534] [client] PHP Fatal error: Uncaught Error: Call to undefined function WP_Rest_Yoast_Meta_Plugin\\Frontend\\mb_convert_encoding() in /var/www/html/wp-content/plugins/wp-rest-yoast-meta/frontend/class-frontend.php:346\nStack trace:\n#0 /var/www/html/wp-content/plugins/wp-rest-yoast-meta/frontend/class-frontend.php(327): WP_Rest_Yoast_Meta_Plugin\\Frontend\\Frontend->parse_using_domdocument(‘\\n<!– This site…’)\n#1 /var/www/html/wp-content/plugins/wp-rest-yoast-meta/frontend/class-frontend.php(258): WP_Rest_Yoast_Meta_Plugin\\Frontend\\Frontend->parse(‘\\n<!– This site…’)\n#2 /var/www/html/wp-content/plugins/wp-rest-yoast-meta/frontend/class-frontend.php(113): WP_Rest_Yoast_Meta_Plugin\\Frontend\\Frontend->get_yoast_data(Object(WP_Post))\n#3 /var/www/html/wp-includes/class-wp-hook.php(288): WP_Rest_Yoast_Meta_Plugin\\Frontend\\Frontend->rest_add_yoast(Object(WP_REST_Response), Object(WP_Post), Object(WP_REST_Request))\n#4 /var/www/html/wp-includes/plugin.php(206): WP_Hook->apply_filters(Object(WP_REST_Response), Array)\n#5 /var/www/html/wp-includes/re in /var/www/html/wp-content/plugins/wp-rest-yoast-meta/frontend/class-frontend.php on line 346, referer:

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey @jhaankitesh,

    It is happening because of incorrect handling of PHP namespaces. and I believe this needs to be handled by the plugin author and given in the next update ASAP.

    But just in case you need a quick fix, please change the code from just mb_convert_encoding() to \mb_convert_encoding() in the file /var/www/html/wp-content/plugins/wp-rest-yoast-meta/frontend/class-frontend.php line 346.

    Plugin Author Richard Korthuis


    Hi @jhaankitesh,

    Thank you for using our plugin! This is most probably not due to the namespaces fallback (as @ashwinparthasarathi suggests), but due to the fact php-mbstring is not installed on your server.

    @ashwinparthasarathi From the same page you are linking to: For functions and constants, PHP will fall back to global functions or constants if a namespaced function or constant does not exist. Since we have not declared a function with the same name within our namespace, PHP will fall back to the global function. The error comes from the fact that the global function does not exist, so adding a \ in front of the function will not solve this issue.

    @rockfire, nice catch. It is mostly that the mbstring extension isn’t installed.

    Plugin Author Richard Korthuis


    This thread has been marked as resolved due to lack of activity.

    You’re always welcome to open a new topic.

    Thanks for understanding!

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.