# Does gravitational lensing violate Fermat's Principle that light must travel in straight lines?

Does bending of light due to warping of space violate Fermat's Principle or is it that in the principle light goes in a straight line with respect to space (taking space as the reference) and in Relativity that reference itself is bending and so does the light?

Fermat's principle is a bit more complicated than what you state: it says that in travelling from $A$ to $B$, light will go along the paths that will minimize the time taken to get there - and these may or may not be straight lines. (See e.g. Wikipedia.)