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)
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_PROXIES to only use IPv4 addresses (not REMOTE_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: nextcloud/server#44475
This could potentially be a simple documentation patch, unless it makes sense to implement IPv6 detection in Davis?
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)
Client(s) exhibiting the issue
All
Relevant environment variables
Needs `SYMFONY_TRUSTED_PROXIES=127.0.0.1`Steps to reproduce
-ipv6)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_ADDRis set, which causes Symfony to check if the remote address matches the trusted proxy list.The fix could be:
SYMFONY_TRUSTED_PROXIESto only use IPv4 addresses (notREMOTE_ADDR)Wait, let me think about this more. The
REMOTE_ADDRspecial 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 callinginet_pton(). Since IPv6 is disabled in PHP,inet_pton('::1')returns false andAF_INET6isn'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 onREMOTE_ADDR. Let me look for the framework configuration file to see how this is currently set up.*Similar find in the wild: nextcloud/server#44475
This could potentially be a simple documentation patch, unless it makes sense to implement IPv6 detection in Davis?