MDL-48587 core: Fix error in getremoteaddr for unsupported php versions