Steps to reproduce:
export ALL_PROXY=socks5://127.0.0.1:1080 (assume a SOCKS5 proxy server is there);
curl a ftp resource with no extra options;
you can see from strace that curl tries to connect to the ftp server directly but then take it as a SOCKS5 server.
A strace result is available in the attachment list. In addition, curl works fine with --socks5/--socks5-hostname option.