Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated/Removed constant used #176

Closed
famfo opened this issue Feb 8, 2025 · 7 comments
Closed

Deprecated/Removed constant used #176

famfo opened this issue Feb 8, 2025 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@famfo
Copy link

famfo commented Feb 8, 2025

After upgrading from v4.x to v5.x, davis no longer started due to:

Uncaught Error: Undefined constant Symfony\Component\HttpFoundation\Request::HEADER_X_FORWARDED_ALL in public/index.php:24

HEADER_X_FORWARDED_ALL seems to be deprecated and now removed, I had to replace it with HEADER_X_FORWARDED_FOR in my installation. HEADER_X_FORWARDED_ALL seems to include HEADER_X_FORWARDED_FOR, HEADER_X_FORWARDED_HOST, HEADER_X_FORWARDED_PORT and HEADER_X_FORWARDED_PROTO.

Here is my patch for this, I am not familiar with PHP and the other headers though, that's why I'm not opening a PR.

 if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
-    Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
+    Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR ^ Request::HEADER_X_FORWARDED_HOST);
 }
@tchapi
Copy link
Owner

tchapi commented Feb 8, 2025

Thanks @famfo for your report.

Can you indicate on what PHP version (and reverse proxy) you are?

@tchapi tchapi added the bug Something isn't working label Feb 8, 2025
@tchapi tchapi self-assigned this Feb 8, 2025
@famfo
Copy link
Author

famfo commented Feb 8, 2025

php version: 8.3.16
reverse proxy is caddy: v2.9.1

@tchapi
Copy link
Owner

tchapi commented Feb 8, 2025

Thank you; This is weird as it's working on my side, but you're right that the index file is lagging in terms of version, I'll look to update it asap

@famfo
Copy link
Author

famfo commented Feb 8, 2025

I ran composer update after updating the version, that may have updated some part of symfony to an incompatible version

@tchapi
Copy link
Owner

tchapi commented Feb 9, 2025

Probably fixed in #177 — could you try that everything works on your side with this branch?

Thanks a lot!

@famfo
Copy link
Author

famfo commented Feb 9, 2025

That seems to have fixed it, thanks ^^

@tchapi
Copy link
Owner

tchapi commented Feb 13, 2025

Merged in master now :)

I'll try to make a release before end of week

@tchapi tchapi closed this as completed Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants