Skip to content

Fix An Exception - #1793

Merged
ssddanbrown merged 1 commit into
BookStackApp:masterfrom
abublihi:master
Dec 27, 2019
Merged

ssddanbrown merged 1 commit into
BookStackApp:masterfrom
abublihi:master

Conversation

@abublihi

Copy link
Copy Markdown
Contributor

Fix an exception error

ErrorException
Declaration of BookStack\Http\Middleware\TrustProxies::handle($request, Closure $next) should be compatible with Fideloper\Proxy\TrustProxies::handle(Illuminate\Http\Request $request, Closure $next) 

…ble with Fideloper\Proxy\TrustProxies::handle"
@ssddanbrown

Copy link
Copy Markdown
Member

Thank you for the pull request @abublihi.
Would you be able to confirm when this error would actually appear? Just intrigued at why this issue has not shown up earlier.

@abublihi

abublihi commented Nov 20, 2019

Copy link
Copy Markdown
Contributor Author

This issue appeared after the installation and configuration immediately,

The issue did not appeare after I have installed the release branch, it only appears on the master branch.

@abublihi

Copy link
Copy Markdown
Contributor Author

the error accord because of the version of fideloper/proxy packge

version 3.3.4

    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure                 $next
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        $this->setTrustedProxyHeaderNames($request);
        $this->setTrustedProxyIpAddresses($request);
        return $next($request);
    }

version 4.2.1

    /**
     * Handle an incoming request.
     *
     * @param \Illuminate\Http\Request $request
     * @param \Closure                 $next
     *
     * @throws \Symfony\Component\HttpKernel\Exception\HttpException
     *
     * @return mixed
     */
    public function handle(Request $request, Closure $next)
    {
        $request::setTrustedProxies([], $this->getTrustedHeaderNames()); // Reset trusted proxies between requests
        $this->setTrustedProxyIpAddresses($request);
        return $next($request);
    }

@ssddanbrown

Copy link
Copy Markdown
Member

@abublihi Sure, I totally get what has changed and why this error might get thrown but I'm essentially curious as to why I have not seen this issue on my own system.

Would you be able to confirm your exact PHP version and operating system?

@abublihi

Copy link
Copy Markdown
Contributor Author

Yes you are right.

Operating System: MacOs Sierra
Php 7.1

@ssddanbrown ssddanbrown added this to the v0.28.0 milestone Dec 27, 2019
@ssddanbrown

Copy link
Copy Markdown
Member

I never managed to find how an error would be thrown but I'll stop digging.

Thank you again @abublihi for this change. Will merge in to be part of v0.28.

@ssddanbrown
ssddanbrown merged commit 6f9cad2 into BookStackApp:master Dec 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants