[ticket/12140] Avoid endless loop in diff creation

PHPBB3-12140