Avoid PHP warning in fopen, fixes #6296