Selaa lähdekoodia

ZF-10546 and ZF-10547: better handling of glob() return

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23160 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 15 vuotta sitten
vanhempi
commit
1b4891013c

+ 1 - 1
library/Zend/Loader/Autoloader.php

@@ -560,7 +560,7 @@ class Zend_Loader_Autoloader
         $versionLen = strlen($version);
         $versions   = array();
         $dirs       = glob("$path/*", GLOB_ONLYDIR);
-        foreach ($dirs as $dir) {
+        foreach ((array) $dirs as $dir) {
             $dirName = substr($dir, strlen($path) + 1);
             if (!preg_match('/^(?:ZendFramework-)?(\d+\.\d+\.\d+((a|b|pl|pr|p|rc)\d+)?)(?:-minimal)?$/i', $dirName, $matches)) {
                 continue;

+ 6 - 2
library/Zend/OpenId/Consumer/Storage/File.php

@@ -479,20 +479,24 @@ class Zend_OpenId_Consumer_Storage_File extends Zend_OpenId_Consumer_Storage
         }
         try {
             if (!is_int($date) && !is_string($date)) {
-                foreach (glob($this->_dir . '/nonce_*') as $name) {
+                $nonceFiles = glob($this->_dir . '/nonce_*');
+                foreach ((array) $nonceFiles as $name) {
                     @unlink($name);
                 }
+                unset($nonceFiles);
             } else {
                 if (is_string($date)) {
                     $time = time($date);
                 } else {
                     $time = $date;
                 }
-                foreach (glob($this->_dir . '/nonce_*') as $name) {
+                $nonceFiles = glob($this->_dir . '/nonce_*');
+                foreach ((array) $nonceFiles as $name) {
                     if (filemtime($name) < $time) {
                         @unlink($name);
                     }
                 }
+                unset($nonceFiles);
             }
             if ($lock !== false) {
                 fclose($lock);