# Why is Ampère's law violated if there are no fringe fields?

What's wrong in this diagram?

The reason is this: magnetic field lines between the two poles of magnet are perfectly straight in the given diagram, which is not possible.

Fringing effect of the lines is inevitable

I was investigating why there is fringing effect, and then I came across a line in NCERT physics text book that if there was no fringing effect it would violate Ampere's law. Can anyone please explain how Ampere's law is violated?

Consider the two paths $ABCDA$ and $EFGHE$.
Path $AB$ contributes a positive value to the $\vec B\cdot d\vec l$ integral but the other parts of the loop contribute nothing, so overall there is a finite value for the $\vec B\cdot d\vec l$ integral but no enclosed current which violates Ampere's law.
Again path $EF$ contributes a positive value to the $\vec B\cdot d\vec l$ integral but now all the other parts of the loop contribute a negative value to the $\vec B\cdot d\vec l$ integral with the result that the total integral is zero as is the enclosed current.