The bug
When using /setblock (or /fill) to place air in a block, it fails if the block is currently waterlogged, placing water instead. /clone works fine.
How to reproduce
Place slab
Place water in it
Stand on the slab
/setblock ~ ~ ~ air
→ ❌ Water is placed
Expected behavior
Block should end up as pure air. Otherwise, this results in the following contradiction:
/setblock ~ ~ ~ air
/testforblock ~ ~ ~ air
Block not found
It doesn't place water, it just replaces the waterlogged block with something else and keeps it waterlogged.