An electromagnetic wave doesn't violate the conservation of energy. Maxwell's electromagnetism does. When you apply the Maxwell's equations to two beams of light of the same frequency, collinear, out of phase 180 degree, occurs the phenomenon of destructive interference. In this special case the electric field of one wave is canceled with the electric field of the other wave; the same happens with the magnetic fields. Both fields become zero. Following Maxwell the energy is contained only in those fields.
Let make the math: Let us have these two waves: Be $E$ = electric field; $B$=magnetic field
$$E_1 = E_m \sin (kx - \omega t), \quad E_2 = E_m \sin (kx - \omega t + p)\\ B_1 = B_m \sin (kx - \omega t), \quad B_2 = B_m \sin (kx - \omega t + p) $$
$E = E_1 + E_2$ and $B = B_1 + B_2$
\begin{align} E &= E_m \sin (kx - \omega t) + E_m \sin (kx - \omega t + p) \\ B &=B_m \sin (kx - \omega t) + B_m \sin (kx - \omega t + p) \end{align}
But, $\sin (kx - \omega t + p) = - \sin (kx – \omega t)$ ,
Then, $E = 0$ and $B = 0$ and,
\begin{align} U_T& = U_E + U_B \\ &= \frac12 \epsilon_0E^2 + \frac12\mu_0B^2 \\ &= 0 \end{align}
According to Maxwell equations, in destructive interference of two collinear beams out of phase 180 degree, the energy density, which is a function of the electric and magnetic fields, is destroyed too. In this way, the principle of conservation of energy is violated.