5.4.1: RuntimeException: Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6"
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 751
- Forks
- 44
- Avg merge
- 15h 14m
- Merged PRs (30d)
- 8
Description
Davis version
5.4.1
Installation method
Bare metal / manual
PHP version (bare metal only)
8.2.30
Database
MySQL
Reverse proxy
Apache
Authentication method
LDAP
Affected protocol(s)
- CalDAV
- CardDAV
- WebDAV
- Admin dashboard
- API
Client(s) exhibiting the issue
All
Relevant environment variables
Needs `SYMFONY_TRUSTED_PROXIES=127.0.0.1`
Steps to reproduce
- disable PHP IPv6 (my Gentoo PHP build is systemwide
-ipv6) - launch Davis
- everything 500s
Expected behaviour
200
Actual behaviour
500
Logs
Additional context
This ended up easy pickings for Copilot
Reasoning
*The problem is clear: PHP was compiled without IPv6 support, but Symfony is trying to check IPv6 addresses. This is happening because SYMFONY_TRUSTED_PROXIES=REMOTE_ADDR is set, which causes Symfony to check if the remote address matches the trusted proxy list.
The fix could be:
- Change
SYMFONY_TRUSTED_PROXIESto only use IPv4 addresses (notREMOTE_ADDR) - Or ensure the REMOTE_ADDR being passed is always IPv4
Wait, let me think about this more. The REMOTE_ADDR special value in Symfony means "trust the remote IP as a proxy".
When Symfony validates this, it runs the IP through IpUtils::checkIp(), which attempts to determine if it's IPv6 by calling inet_pton(). Since IPv6 is disabled in PHP, inet_pton('::1') returns false and AF_INET6 isn't defined, causing the check to fail and throw an exception. The real solution is to either disable IPv6 checking when it's not available in PHP, or configure the trusted proxies to only accept IPv4 addresses. better approach would be to explicitly configure the trusted proxies with specific IPv4 addresses instead of relying on REMOTE_ADDR. Let me look for the framework configuration file to see how this is currently set up.*
Similar find in the wild: https://github.com/nextcloud/server/pull/44475
This could potentially be a simple documentation patch, unless it makes sense to implement IPv6 detection in Davis?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing Symfony's IpUtils::checkIp() from the trusted-proxy configuration described in the issue, then inspect Davis's Symfony configuration entry point. Reproduce with PHP IPv6 disabled and the reported proxy setting. Done means the application no longer returns 500 for this environment, with the appropriate behavior documented or covered by a regression check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, symfony
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100