[Html_ajax-svn] [354] fix for fix for #6295, stream_get_contents() needs a file handle not path, we should just use file_get_contents() anyway

Joshua Eichorn josh at bluga.net
Wed Jan 25 11:56:11 CST 2006


file_get_contents doesn't exists in all versions of php we support
the fread version needs to exists
-josh
arpad at bluga.net wrote:
>
> Revision
>     354
> Author
>     arpad
> Date
>     2006-01-25 11:55:28 -0600 (Wed, 25 Jan 2006)
>
>
>       Log Message
>
> fix for fix for #6295, stream_get_contents() needs a file handle not path, we should just use file_get_contents() anyway
>
>
>       Modified Paths
>
>     * trunk/AJAX.php <#trunkAJAXphp>
>
>
>       Diff
>
>
>         Modified: trunk/AJAX.php (353 => 354)
>
> --- trunk/AJAX.php	2006-01-25 16:46:04 UTC (rev 353)
> +++ trunk/AJAX.php	2006-01-25 17:55:28 UTC (rev 354)
> @@ -501,19 +501,12 @@
>          if (empty($this->_payload)) {
>              if (isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
>                  $this->_payload = $GLOBALS['HTTP_RAW_POST_DATA'];
> +            } else if (function_exists('file_get_contents')) {
> +                // both file_get_contents() and php://input require PHP >= 4.3.0
> +                $this->_payload = file_get_contents('php://input');
> +            } else {
> +                $this->_payload = '';
>              }
> -            else {
> -                if (function_exists('stream_get_contents')) {
> -                    $this->_payload = stream_get_contents('php://input');
> -                }
> -                else {
> -                    $handle = fopen('php://input','r');
> -                    while (!feof($handle)) {
> -                        $this->_payload .= fread($handle, 8192);
> -                    }
> -                }
> -            }
> -            
>          }
>          return $this->_payload;
>      }
>
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Html_ajax-svn mailing list
> Html_ajax-svn at lists.bluga.net
> http://lists.bluga.net/mailman/listinfo/html_ajax-svn
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bluga.net/pipermail/html_ajax-svn/attachments/20060125/8b25f6ea/attachment.html


More information about the Html_ajax-svn mailing list