Fix PR54848 in a 2.4.x backportable format. Ideally deprecating the use of ->client in whatever version of 2.4 this is added into would be more logical.