• Resolved cudak

    (@cudak)


    Hi there,
    im using the newest verion (1.2.0) of this plugin with wordpress 5.2.4.
    When I try to call “wp-json/wp/v2/users/me” I get the following error log:
    Fatal error: Uncaught Error: Call to undefined function getallheaders() in /home/forge/pt.alphactor.de/public/wp-content/plugins/wp-rest-api-authentication/admin/partials/flow/class-mo-api-authentication-jwt-auth.php:5 Stack trace: #0 /home/forge/pt.alphactor.de/public/wp-content/plugins/wp-rest-api-authentication/admin/partials/flow/mo-token-api-flow.php(125): Mo_API_Authentication_JWT_Auth::mo_api_auth_is_valid_request() #1 /home/forge/pt.alphactor.de/public/wp-content/plugins/wp-rest-api-authentication/admin/partials/flow/mo-token-api-flow.php(105): mo_api_auth_is_valid_request() #2 /home/forge/pt.alphactor.de/public/wp-content/plugins/wp-rest-api-authentication/admin/class-miniorange-api-authentication-admin.php(166): mo_api_auth_restrict_rest_api_for_invalid_users() #3 /home/forge/pt.alphactor.de/public/wp-includes/class-wp-hook.php(286): Miniorange_API_Authentication_Admin->mo_api_auth_initialize_api_flow(Object(WP_REST_Server)) #4 /home/forge/pt.alphactor.de/public/wp-includes/class-wp-hook.php(310): WP_Hook->apply in /home/forge/pt.alphactor.de/public/wp-content/plugins/wp-rest-api-authentication/admin/partials/flow/class-mo-api-authentication-jwt-auth.php on line 5

Viewing 1 replies (of 1 total)
  • Plugin Author miniOrange

    (@cyberlord92)

    Hi,

    getallheaders() is an apache specific function. However, there are some versions of PHP (especially Zend) that do not contain this function.

    We will publish a release soon to handle this case for PHP versions which has this issue.

    Alternatively, you can add the below code in your functions.php

    if (!function_exists('getallheaders')) {
                function getallheaders() {
                    $headers = [];
                    foreach ($_SERVER as $name => $value) {
                        if (substr($name, 0, 5) == 'HTTP_') {
                            $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
                        }
                    }
                    return $headers;
                }
            }
Viewing 1 replies (of 1 total)
  • The topic ‘Call to undefined function getallheaders()’ is closed to new replies.