No state, county, municipal, or other public officer within the state of Washington, who receives from the state, or from any county or municipality therein, a fixed and stated salary as compensation for services rendered as such public officer shall be allowed or paid any per diem for attending or testifying on behalf of the state of Washington, or any county or municipality therein, at any trial or other judicial proceeding, in any state, county, or municipal court within this state; nor shall such officer, in any case, be allowed nor paid any per diem for attending or testifying in any state or municipal court of this state, in regard to matters and information that have come to his or her knowledge in connection with and as a result of the performance of his or her duties as a public officer as aforesaid: PROVIDED, This section shall not apply when any deduction shall be made from the regular salary of such officer by reason of his or her being in attendance upon the superior court, but in such cases regular witness fees shall be paid; and further, that if a public officer be subpoenaed and required to appear or testify in judicial proceedings in a county other than that in which he or she resides, then said public officer shall be entitled to receive per diem and mileage as provided by statute in other cases; and, PROVIDED FURTHER, That this section shall not apply to police officers when called as witnesses in the superior courts during hours when they are off duty as such officers. A law enforcement officer who has issued a notice of traffic infraction is not entitled to receive witness fees or mileage in a contested traffic infraction case.