diff vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php @ 16:c2387f117808

Routine composer update
author Chris Cannam
date Tue, 10 Jul 2018 15:07:59 +0100
parents 7a779792577d
children 129ea1e6d783
line wrap: on
line diff
--- a/vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php	Thu Apr 26 11:26:54 2018 +0100
+++ b/vendor/zendframework/zend-feed/src/PubSubHubbub/AbstractCallback.php	Tue Jul 10 15:07:59 2018 +0100
@@ -34,6 +34,17 @@
     protected $httpResponse = null;
 
     /**
+     * The input stream to use when retrieving the request body. Defaults to
+     * php://input, but can be set to another value in order to force usage
+     * of another input method. This should primarily be used for testing
+     * purposes.
+     *
+     * @var string|resource String indicates a filename or stream to open;
+     *     resource indicates an already created stream to use.
+     */
+    protected $inputStream = 'php://input';
+
+    /**
      * The number of Subscribers for which any updates are on behalf of.
      *
      * @var int
@@ -287,13 +298,10 @@
     protected function _getRawBody()
     {
         // @codingStandardsIgnoreEnd
-        $body = file_get_contents('php://input');
-        if (strlen(trim($body)) == 0 && isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
-            $body = $GLOBALS['HTTP_RAW_POST_DATA'];
-        }
-        if (strlen(trim($body)) > 0) {
-            return $body;
-        }
-        return false;
+        $body = is_resource($this->inputStream)
+            ? stream_get_contents($this->inputStream)
+            : file_get_contents($this->inputStream);
+
+        return strlen(trim($body)) > 0 ? $body : false;
     }
 }