Explorar el Código

Favicon array bug

Case problem and isset check
Alexandre Alapetite hace 10 años
padre
commit
f3696784ea
Se han modificado 2 ficheros con 3 adiciones y 2 borrados
  1. 2 1
      lib/Favicon/DataAccess.php
  2. 1 1
      lib/Favicon/Favicon.php

+ 2 - 1
lib/Favicon/DataAccess.php

@@ -15,7 +15,8 @@ class DataAccess {
 	
 	
 	public function retrieveHeader($url) {
 	public function retrieveHeader($url) {
 	    $this->set_context();
 	    $this->set_context();
-		return @get_headers($url, TRUE);
+		$headers = @get_headers($url, 1);
+		return array_change_key_case($headers);
 	}
 	}
 	
 	
     public function saveCache($file, $data) {
     public function saveCache($file, $data) {

+ 1 - 1
lib/Favicon/Favicon.php

@@ -99,7 +99,7 @@ class Favicon
             switch ($status) {
             switch ($status) {
                 case '301':
                 case '301':
                 case '302':
                 case '302':
-                    $url = $headers['Location'];
+                    $url = isset($headers['location']) ? $headers['location'] : '';
                     break;
                     break;
                 default:
                 default:
                     $loop = FALSE;
                     $loop = FALSE;