• Hi,
    I’m using UAC in conjunction with TypeRocket to build an application.
    I have a route handled by TypeRocket. If I go there, UAC will produce a fatal PHP error:

    PHP Fatal error: Uncaught TypeError: Argument 1 passed to UserAccessManager\Controller\Frontend\PostController::filterRawPosts() must be of the type array, null given, called in /wp-content/plugins/user-access-manager/src/Controller/Frontend/PostController.php on line 308 and defined in /wp-content/plugins/user-access-manager/src/Controller/Frontend/PostController.php:277
    Stack trace:
    #0 /wp-content/plugins/user-access-manager/src/Controller/Frontend/PostController.php(308): UserAccessManager\Controller\Frontend\PostController->filterRawPosts(NULL)
    #1 /wp-includes/class-wp-hook.php(288): UserAccessManager\Controller\Frontend\PostController->showPosts(NULL)
    #2 /wp-includes/plugin.php(244): WP_ in /wp-content/plugins/user-access-manager/src/Controller/Frontend/PostController.php on line 277
    [27-Jan-2019 17:28:43 UTC] PHP Fatal error: Uncaught TypeError: Argument 1 passed to UserAccessManager\Controller\Frontend\PostController::filterRawPosts() must be of the type array, null given, called in /wp-content/plugins/user-access-manager/src/Controller/Frontend/PostController.php on line 308 and defined in /wp-content/plugins/user-access-manager/src/Controller/Frontend/PostController.php:277

    For the time being, I’ve patched PostController::showPosts like this:
    public function showPosts($showPosts = [])
    {
    // 20190127 – MG – with a typerocket route active, $showPosts === null, for some reason, and that breaks the plugin.
    if( null === $showPosts ) {
    $showPosts = [];
    }
    // end edit.
    if ($this->wordpress->isFeed() === false || $this->mainConfig->protectFeed() === true) {
    $showPosts = $this->filterRawPosts($showPosts);
    }

    $this->restoreFilters();

    return $showPosts;
    }

    which is certainly not the best patch possible, but it lets me keep working. Would the author take a look at this issue?

    Thanks,
    MG

  • The topic ‘Argument 1 passed to PostController::filterRawPosts() is null’ is closed to new replies.