Check value from opendir().

This check is needed for PHP 5.3 or higher.