fix scandir for php 5.3