Violations of both the weak equivalence principle ( WEP ) and Lorentz invariance can produce vacuum birefringence , which leads to an energy-dependent rotation of the polarization vector of linearly polarized emission from a given astrophysical source . However , the search for the birefringent effect has been hindered by our ignorance concerning the intrinsic polarization angle in different energy bands . Considering the contributions to the observed linear polarization angle from both the intrinsic polarization angle and the rotation angles induced by violations of the WEP and Lorentz invariance , and assuming the intrinsic polarization angle is an unknown constant , we simultaneously obtain robust bounds on possible deviations from the WEP and Lorentz invariance , by directly fitting the multiwavelength polarimetric data of the optical afterglows of gamma-ray burst ( GRB ) 020813 and GRB 021004 . Here we show that at the 3 \sigma confidence level , the difference of the parameterized post-Newtonian parameter \gamma values characterizing the departure from the WEP is constrained to be \Delta \gamma = \left ( -4.5 ^ { +10.0 } _ { -16.0 } \right ) \times 10 ^ { -24 } and the birefringent parameter \eta quantifying the broken degree of Lorentz invariance is limited to be \eta = \left ( 6.5 ^ { +15.0 } _ { -14.0 } \right ) \times 10 ^ { -7 } . These are the first simultaneous verifications of the WEP and Lorentz invariance in the photon sector . More stringent limits can be expected as the analysis presented here is applied to future multiwavelength polarization observations in the prompt gamma-ray emission of GRBs .