What happened was, I have two named items called "Keycard," and when I used the tesfor command, one item turned into the other.
Steps to Replicate:
1) Get an iron hoe and a blaze rod and name them "Keycard."
2) Place down a command block and enter the command,
testfor @p {SelectedItemSlot:0,Inventory:[{Slot:0b,tag:{display:{Name:"Keycard"}}}]}
and attach a button to it.
3) Drag one of the "Keycard" items into the first slot and click the button.
4) Scroll away from the item and click the button again to reset it.
5) Drag the second "Keycard" Item into the first slot and click the button again
6) The second item will turn into the first item, still named "Keycard".
Related issues
Attachments
Comments


If I were to name two hoes (wooden and iron, as I've tested) and name them "Keycard," they stay the same. The wood stays wood while iron stays iron, and they both open the door. What's the difference between tools and items?

Fail to see a bug here.
Both items named "Keycard" trigger the command block output.
Please refine the description and define what's the bug.

The bug is that, one of the items (e.g. the blaze rod) turns into the iron hoe and vice versa after clicking the button.

Cannot confirm, see my screeshots. Probably you're seeing MC-341