• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisiónae843f94ad43ceff88dd5402b1d1c9471507bf72 (tree)
Tiempo2014-11-30 13:00:19
Autorhenoheno <henoheno>
Commiterumorigu

Log Message

BugTrack2/236: Care for readdir() returns FALSE

Cambiar Resumen

Diferencia incremental

--- a/plugin/rename.inc.php
+++ b/plugin/rename.inc.php
@@ -307,21 +307,20 @@ function plugin_rename_get_files($pages)
307307 $matches = array();
308308 foreach ($dirs as $path) {
309309 $dir = opendir($path);
310- if (! $dir) continue;
311-
312- while ($file = readdir($dir)) {
310+ if (! $dir) continue; // TODO: !== FALSE or die()?
311+ while (($file = readdir($dir)) !== FALSE) {
313312 if ($file == '.' || $file == '..') continue;
314-
315- foreach ($pages as $from=>$to) {
313+ foreach ($pages as $from => $to) {
314+ // TODO: preg_quote()?
316315 $pattern = '/^' . str_replace('/', '\/', $from) . '([._].+)$/';
317- if (! preg_match($pattern, $file, $matches))
318- continue;
319-
320- $newfile = $to . $matches[1];
321- $files[$from][$path . $file] = $path . $newfile;
316+ if (preg_match($pattern, $file, $matches)) {
317+ $newfile = $to . $matches[1];
318+ $files[$from][$path . $file] = $path . $newfile;
319+ }
322320 }
323321 }
324322 }
323+
325324 return $files;
326325 }
327326