note 115419 added to class.directoryiterator

From: Date: Mon, 21 Jul 2014 10:40:40 +0000
Subject: note 115419 added to class.directoryiterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-199996@lists.php.net to get a copy of this message
Remember that this will throw an exception if the directory cannot be opened. You need to catch the error for proper error handling: <?php try { $iterator = new DirectoryIterator($dir); } catch (Exception $e) { $error = $e->getMessage(); printf("An error occurred:\n %s\nCouldn't process directory: %s - aborting\n", $error, $dir); } ?> Use this if you're getting a RuntimeException. ---- Server IP: 72.52.91.14 Probable Submitter: 92.109.206.41 ---- Manual Page -- http://php.net/manual/en/class.directoryiterator.php Edit -- https://master.php.net/note/edit/115419 Del: integrated -- https://master.php.net/note/delete/115419/integrated Del: useless -- https://master.php.net/note/delete/115419/useless Del: bad code -- https://master.php.net/note/delete/115419/bad+code Del: spam -- https://master.php.net/note/delete/115419/spam Del: non-english -- https://master.php.net/note/delete/115419/non-english Del: in docs -- https://master.php.net/note/delete/115419/in+docs Del: other reasons-- https://master.php.net/note/delete/115419 Reject -- https://master.php.net/note/reject/115419 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#199996) next »