Check for max_length only when output is required in text format
Merge branch '4.4'