Преглед на файлове

[ZF-10952] Zend_Cache

- fixed check if $_SERVER['REQUEST_URI'] is set. 

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@23653 44c647ce-9c0f-0410-b52a-842ac1e357ba
ramon преди 15 години
родител
ревизия
c5acc41828
променени са 2 файла, в които са добавени 16 реда и са изтрити 3 реда
  1. 5 3
      library/Zend/Cache/Frontend/Page.php
  2. 11 0
      tests/Zend/Cache/PageFrontendTest.php

+ 5 - 3
library/Zend/Cache/Frontend/Page.php

@@ -243,9 +243,11 @@ class Zend_Cache_Frontend_Page extends Zend_Cache_Core
     {
         $this->_cancel = false;
         $lastMatchingRegexp = null;
-        foreach ($this->_specificOptions['regexps'] as $regexp => $conf) {
-            if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) {
-                $lastMatchingRegexp = $regexp;
+        if (isset($_SERVER['REQUEST_URI'])) {
+            foreach ($this->_specificOptions['regexps'] as $regexp => $conf) {
+                if (preg_match("`$regexp`", $_SERVER['REQUEST_URI'])) {
+                    $lastMatchingRegexp = $regexp;
+                }
             }
         }
         $this->_activeOptions = $this->_specificOptions['default_options'];

+ 11 - 0
tests/Zend/Cache/PageFrontendTest.php

@@ -195,5 +195,16 @@ class Zend_Cache_PageFrontendTest extends PHPUnit_Framework_TestCase {
         ob_implicit_flush(true);
         $this->assertEquals('DEBUG HEADER : This is a cached page !foo', $data);
     }
+
+    /**
+     * @group ZF-10952
+     */
+    public function testNootice()
+    {
+        $regex = array('^/article/' => array('cache' => false));
+        $this->_instance->setOption('regexps', $regex);
+        $this->_instance->setOption('caching', false);
+        $this->_instance->start('zf10952');
+    }
 }