A player selector (so @a, @p and @r) with cubic detection area (so for example @a[x=0,y=0,z=0,dx=2,dx=2,dx=2]) will only detect players correctly if there are less than 32 Entities loaded. Otherwise it will always find a player regardless of whether he is inside the detection box or not.
Also if you use @e as a selector it will work just fine, so if you are experiencing that problem yourself you can fix it by using @e[x=0,y=0,z=0,dx=2,dx=2,dx=2,type=Player]
(This issue exists as of 14w29a)
Steps to reproduce:
1.
Create a new creative superflat world with the preset "Redstone Ready" (The only reason why you should take that preset is because no mobs spawn on it)
2.
Enter "/testfor @a[x=0,y=0,z=0,dx=2,dy=2,dz=2]" into the chat.
Nothing should happen because it sould only detect you if you are inside a 3x3x3 area of which the north west bottom corner is located at 0 0 0.
3.
Now start spawning pigs or whatever with spawneggs until your total entity count (which you can observe in the F3-Debug menu in the third line (E:<rendered entities>:<total entities>)) rises up to 31.
4.
Now run the command from Step 2 again. Still nothing should happen, but if you add one entity (for example another pig) and run the command again the chat should say "Found <Player name>" even though it shouldn't because the player is not in the detection box.