Quellcode durchsuchen

[ZF-11783] Zend_Amf
Fixes: Zend_Amf_Response_Http emits notice when $_SERVER['HTTPS'] not defined


git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@24523 44c647ce-9c0f-0410-b52a-842ac1e357ba

adamlundrigan vor 14 Jahren
Ursprung
Commit
6d5724f278

+ 1 - 1
library/Zend/Amf/Response/Http.php

@@ -56,7 +56,7 @@ class Zend_Amf_Response_Http extends Zend_Amf_Response
 
     protected function isIeOverSsl()
     {
-        $ssl = $_SERVER['HTTPS'];
+        $ssl = isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : false;
         if (!$ssl || ($ssl == 'off')) {
             // IIS reports "off", whereas other browsers simply don't populate
             return false;

+ 2 - 0
tests/Zend/Amf/AllTests.php

@@ -27,6 +27,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) {
 require_once 'Zend/Amf/Adobe/IntrospectorTest.php';
 require_once 'Zend/Amf/RequestTest.php';
 require_once 'Zend/Amf/ResponseTest.php';
+require_once 'Zend/Amf/Response/HttpTest.php';
 require_once 'Zend/Amf/ServerTest.php';
 require_once 'Zend/Amf/TypeLoaderTest.php';
 require_once 'Zend/Amf/Util/BinaryStreamTest.php';
@@ -57,6 +58,7 @@ class Zend_Amf_AllTests
         $suite->addTestSuite('Zend_Amf_Adobe_IntrospectorTest');
         $suite->addTestSuite('Zend_Amf_RequestTest');
         $suite->addTestSuite('Zend_Amf_ResponseTest');
+        $suite->addTestSuite('Zend_Amf_Response_HttpTest');
         $suite->addTestSuite('Zend_Amf_ServerTest');
         $suite->addTestSuite('Zend_Amf_TypeLoaderTest');
         $suite->addTestSuite('Zend_Amf_Util_BinaryStreamTest');

+ 85 - 0
tests/Zend/Amf/Response/HttpTest.php

@@ -0,0 +1,85 @@
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Amf
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+if (!defined('PHPUnit_MAIN_METHOD')) {
+    define('PHPUnit_MAIN_METHOD', 'Zend_Amf_Response_HttpTest::main');
+}
+
+/**
+ * @see Zend_Amf_Response_Http
+ */
+require_once 'Zend/Amf/Response/Http.php';
+
+/**
+ * Test case for Zend_Amf_Response
+ *
+ * @category   Zend
+ * @package    Zend_Amf
+ * @subpackage UnitTests
+ * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @group      Zend_Amf
+ * @group      Zend_Amf_Response
+ */
+class Zend_Amf_Response_HttpTest extends PHPUnit_Framework_TestCase
+{
+    
+    /**
+     * Runs the test methods of this class.
+     *
+     * @return void
+     */
+    public static function main()
+    {
+        $suite  = new PHPUnit_Framework_TestSuite("Zend_Amf_Response_HttpTest");
+        $result = PHPUnit_TextUI_TestRunner::run($suite);
+    }
+    
+    /**
+     * Ensure isIeOverSsl() does not emit a notice when $_SERVER['HTTPS'] not set
+     * @group ZF-11783
+     */
+    public function testDoesNotEmitNoticeWhenHttpsServerKeyNotSet()
+    {
+        $req = new ZF11783_ExposeIsIeOverSsl();
+        $this->assertFalse($req->isIeOverSsl());
+    }
+
+}
+
+/**
+ * Expose Zend_Amf_Response_Http::isIeOverSsl for testing
+ * @see ZF-11783
+ */
+class ZF11783_ExposeIsIeOverSsl extends Zend_Amf_Response_Http
+{
+    public function isIeOverSsl() {
+        return parent::isIeOverSsl();
+    }
+}
+
+
+if (PHPUnit_MAIN_METHOD == 'Zend_Amf_Response_HttpTest::main') {
+    Zend_Amf_Response_HttpTest::main();
+}
+
+