From 1801d324e95dca425a850088c8489ce626da1f92 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 8 Apr 2020 15:24:20 +0200 Subject: update to 2.0.0 raise dependency on PHP 7.3 add devel sub-package --- REFLECTION | 496 ++++++++++++++++++++++++++++++++++++-------------- php-pecl-request.spec | 90 +++++---- 2 files changed, 423 insertions(+), 163 deletions(-) diff --git a/REFLECTION b/REFLECTION index 6e3269a..821db6c 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,13 +1,11 @@ -Extension [ extension #181 request version 1.0.0b2 ] { +Extension [ extension #113 request version 2.0.0 ] { - Dependencies { Dependency [ spl (Required) ] - Dependency [ date (Required) ] - Dependency [ json (Optional) ] } - - Classes [2] { - Class [ class ServerRequest ] { + - Classes [5] { + Class [ class SapiRequest ] { - Constants [0] { } @@ -15,34 +13,11 @@ Extension [ extension #181 request version 1.0.0b2 ] { - Static properties [0] { } - - Static methods [3] { - Method [ static public method parseAccept ] { - - - Parameters [1] { - Parameter #0 [ string $header ] - } - - Return [ array or NULL ] - } - - Method [ static public method parseContentType ] { - - - Parameters [1] { - Parameter #0 [ string $header ] - } - - Return [ array or NULL ] - } - - Method [ static public method parseDigestAuth ] { - - - Parameters [1] { - Parameter #0 [ string $header ] - } - - Return [ array or NULL ] - } + - Static methods [0] { } - - Properties [31] { - Property [ private $_initialized ] + - Properties [27] { + Property [ private $isUnconstructed ] Property [ public $accept ] Property [ public $acceptCharset ] Property [ public $acceptEncoding ] @@ -57,84 +32,238 @@ Extension [ extension #181 request version 1.0.0b2 ] { Property [ public $contentMd5 ] Property [ public $contentType ] Property [ public $cookie ] - Property [ public $env ] Property [ public $files ] Property [ public $forwarded ] Property [ public $forwardedFor ] Property [ public $forwardedHost ] Property [ public $forwardedProto ] - Property [ public $get ] Property [ public $headers ] Property [ public $input ] Property [ public $method ] - Property [ public $params ] - Property [ public $post ] + Property [ public $query ] Property [ public $server ] Property [ public $uploads ] Property [ public $url ] - Property [ public $xhr ] } - - Methods [7] { + - Methods [1] { Method [ public method __construct ] { + - Parameters [2] { + Parameter #0 [ array $globals ] + Parameter #1 [ string or NULL $content ] + } + } + } + } + + Interface [ interface SapiResponseInterface ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [23] { + Method [ abstract public method setVersion ] { + - Parameters [1] { - Parameter #0 [ array or NULL $globals ] + Parameter #0 [ string or NULL $version ] } + - Return [ SapiResponseInterface ] } - Method [ final public method withInput ] { + Method [ abstract public method getVersion ] { + + - Parameters [0] { + } + - Return [ string or NULL ] + } + + Method [ abstract public method setCode ] { - Parameters [1] { - Parameter #0 [ $input ] + Parameter #0 [ int or NULL $code ] } - - Return [ ServerRequest ] + - Return [ SapiResponseInterface ] } - Method [ final public method withParam ] { + Method [ abstract public method getCode ] { + + - Parameters [0] { + } + - Return [ int or NULL ] + } + + Method [ abstract public method addHeader ] { + + - Parameters [2] { + Parameter #0 [ string $label ] + Parameter #1 [ string $value ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method setHeader ] { - Parameters [2] { - Parameter #0 [ string $key ] - Parameter #1 [ $val ] + Parameter #0 [ string $label ] + Parameter #1 [ string $value ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method unsetHeader ] { + + - Parameters [1] { + Parameter #0 [ string $label ] } - - Return [ ServerRequest ] + - Return [ SapiResponseInterface ] } - Method [ final public method withParams ] { + Method [ abstract public method getHeader ] { - Parameters [1] { - Parameter #0 [ array $params ] + Parameter #0 [ string $label ] } - - Return [ ServerRequest ] + - Return [ string or NULL ] } - Method [ final public method withoutParam ] { + Method [ abstract public method hasHeader ] { - Parameters [1] { - Parameter #0 [ string $key ] + Parameter #0 [ string $label ] + } + - Return [ bool ] + } + + Method [ abstract public method unsetHeaders ] { + + - Parameters [0] { + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method getHeaders ] { + + - Parameters [0] { } - - Return [ ServerRequest ] + - Return [ array or NULL ] } - Method [ final public method withoutParams ] { + Method [ abstract public method getCookie ] { - Parameters [1] { - Parameter #0 [ array or NULL $keys ] + Parameter #0 [ string $name ] } - - Return [ ServerRequest ] + - Return [ array or NULL ] } - Method [ final public method withUrl ] { + Method [ abstract public method hasCookie ] { - Parameters [1] { - Parameter #0 [ array $url ] + Parameter #0 [ string $name ] } - - Return [ ServerRequest ] + - Return [ bool ] + } + + Method [ abstract public method setCookie ] { + + - Parameters [7] { + Parameter #0 [ string $name ] + Parameter #1 [ string $value ] + Parameter #2 [ $expires_or_options ] + Parameter #3 [ string $path ] + Parameter #4 [ string $domain ] + Parameter #5 [ bool $secure ] + Parameter #6 [ bool $httponly ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method setRawCookie ] { + + - Parameters [7] { + Parameter #0 [ string $name ] + Parameter #1 [ string $value ] + Parameter #2 [ $expires_or_options ] + Parameter #3 [ string $path ] + Parameter #4 [ string $domain ] + Parameter #5 [ bool $secure ] + Parameter #6 [ bool $httponly ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method unsetCookie ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method unsetCookies ] { + + - Parameters [0] { + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method getCookies ] { + + - Parameters [0] { + } + - Return [ array or NULL ] + } + + Method [ abstract public method setContent ] { + + - Parameters [1] { + Parameter #0 [ $content ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method getContent ] { + + - Parameters [0] { + } + } + + Method [ abstract public method setHeaderCallbacks ] { + + - Parameters [1] { + Parameter #0 [ array $callbacks ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method addHeaderCallback ] { + + - Parameters [1] { + Parameter #0 [ callable $callback ] + } + - Return [ SapiResponseInterface ] + } + + Method [ abstract public method getHeaderCallbacks ] { + + - Parameters [0] { + } + - Return [ array or NULL ] } } } - Class [ class ServerResponse ] { + Class [ class SapiResponse implements SapiResponseInterface ] { - Constants [0] { } @@ -146,204 +275,307 @@ Extension [ extension #181 request version 1.0.0b2 ] { } - Properties [6] { - Property [ protected $version ] - Property [ protected $status ] - Property [ protected $headers ] - Property [ protected $cookies ] - Property [ protected $content ] - Property [ protected $callbacks ] + Property [ private $version ] + Property [ private $code ] + Property [ private $headers ] + Property [ private $cookies ] + Property [ private $content ] + Property [ private $callbacks ] } - - Methods [26] { - Method [ public method __construct ] { + - Methods [23] { + Method [ final public method setVersion ] { - - Parameters [0] { + - Parameters [1] { + Parameter #0 [ string or NULL $version ] } + - Return [ SapiResponseInterface ] } - Method [ public method getVersion ] { + Method [ final public method getVersion ] { - Parameters [0] { } - - Return [ string ] + - Return [ string or NULL ] } - Method [ public method setVersion ] { + Method [ final public method setCode ] { - Parameters [1] { - Parameter #0 [ string $version ] + Parameter #0 [ int or NULL $code ] } + - Return [ SapiResponseInterface ] } - Method [ public method getStatus ] { + Method [ final public method getCode ] { - Parameters [0] { } + - Return [ int or NULL ] } - Method [ public method setStatus ] { + Method [ final public method setHeader ] { - - Parameters [1] { - Parameter #0 [ integer $status ] + - Parameters [2] { + Parameter #0 [ string $label ] + Parameter #1 [ string $value ] } + - Return [ SapiResponseInterface ] } - Method [ public method getHeader ] { + Method [ final public method addHeader ] { - - Parameters [0] { + - Parameters [2] { + Parameter #0 [ string $label ] + Parameter #1 [ string $value ] } - - Return [ string or NULL ] + - Return [ SapiResponseInterface ] } - Method [ public method getHeaders ] { + Method [ final public method unsetHeader ] { - - Parameters [0] { + - Parameters [1] { + Parameter #0 [ string $label ] } - - Return [ array ] + - Return [ SapiResponseInterface ] } - Method [ public method setHeader ] { + Method [ final public method getHeader ] { - - Parameters [2] { + - Parameters [1] { Parameter #0 [ string $label ] - Parameter #1 [ $value ] } + - Return [ string or NULL ] } - Method [ public method addHeader ] { + Method [ final public method hasHeader ] { - - Parameters [2] { + - Parameters [1] { Parameter #0 [ string $label ] - Parameter #1 [ $value ] } + - Return [ bool ] } - Method [ public method getCookies ] { + Method [ final public method unsetHeaders ] { - Parameters [0] { } - - Return [ array ] + - Return [ SapiResponseInterface ] } - Method [ public method setCookie ] { + Method [ final public method getHeaders ] { + + - Parameters [0] { + } + - Return [ array or NULL ] + } + + Method [ final public method setCookie ] { - Parameters [7] { - Parameter #0 [ $name ] + Parameter #0 [ string $name ] Parameter #1 [ string $value ] - Parameter #2 [ integer $expires ] + Parameter #2 [ $expires_or_options ] Parameter #3 [ string $path ] Parameter #4 [ string $domain ] - Parameter #5 [ $secure ] - Parameter #6 [ $httponly ] + Parameter #5 [ bool $secure ] + Parameter #6 [ bool $httponly ] } + - Return [ SapiResponseInterface ] } - Method [ public method setRawCookie ] { + Method [ final public method setRawCookie ] { - Parameters [7] { - Parameter #0 [ $name ] + Parameter #0 [ string $name ] Parameter #1 [ string $value ] - Parameter #2 [ integer $expires ] + Parameter #2 [ $expires_or_options ] Parameter #3 [ string $path ] Parameter #4 [ string $domain ] - Parameter #5 [ $secure ] - Parameter #6 [ $httponly ] + Parameter #5 [ bool $secure ] + Parameter #6 [ bool $httponly ] } + - Return [ SapiResponseInterface ] } - Method [ public method getContent ] { + Method [ final public method unsetCookie ] { + + - Parameters [1] { + Parameter #0 [ string $name ] + } + - Return [ SapiResponseInterface ] + } + + Method [ final public method unsetCookies ] { - Parameters [0] { } + - Return [ SapiResponseInterface ] } - Method [ public method setContent ] { + Method [ final public method getCookie ] { - Parameters [1] { - Parameter #0 [ $content ] + Parameter #0 [ string $name ] } + - Return [ array or NULL ] } - Method [ public method setContentJson ] { + Method [ final public method hasCookie ] { - - Parameters [3] { - Parameter #0 [ $content ] - Parameter #1 [ integer $options ] - Parameter #2 [ integer $depth ] + - Parameters [1] { + Parameter #0 [ string $name ] } + - Return [ bool ] } - Method [ public method setContentDownload ] { + Method [ final public method getCookies ] { - - Parameters [4] { - Parameter #0 [ $fh ] - Parameter #1 [ string $name ] - Parameter #2 [ string $disposition ] - Parameter #3 [ array $params ] + - Parameters [0] { } + - Return [ array or NULL ] } - Method [ public method addHeaderCallback ] { + Method [ final public method setContent ] { - Parameters [1] { - Parameter #0 [ callable $callback ] + Parameter #0 [ $content ] } + - Return [ SapiResponseInterface ] } - Method [ public method setHeaderCallbacks ] { + Method [ final public method getContent ] { + + - Parameters [0] { + } + } + + Method [ final public method setHeaderCallbacks ] { - Parameters [1] { Parameter #0 [ array $callbacks ] } + - Return [ SapiResponseInterface ] } - Method [ public method getHeaderCallbacks ] { + Method [ final public method addHeaderCallback ] { + + - Parameters [1] { + Parameter #0 [ callable $callback ] + } + - Return [ SapiResponseInterface ] + } + + Method [ final public method getHeaderCallbacks ] { - Parameters [0] { } + - Return [ array or NULL ] } + } + } - Method [ public method date ] { + Class [ class SapiResponseSender ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [6] { + Method [ public method send ] { - Parameters [1] { - Parameter #0 [ $date ] + Parameter #0 [ SapiResponseInterface $response ] } - - Return [ string ] + - Return [ void ] } - Method [ public method send ] { + Method [ public method runHeaderCallbacks ] { - - Parameters [0] { + - Parameters [1] { + Parameter #0 [ SapiResponseInterface $response ] } + - Return [ void ] } - Method [ protected method runHeaderCallbacks ] { + Method [ public method sendStatus ] { - - Parameters [0] { + - Parameters [1] { + Parameter #0 [ SapiResponseInterface $response ] } + - Return [ void ] } - Method [ protected method sendStatus ] { + Method [ public method sendHeaders ] { - - Parameters [0] { + - Parameters [1] { + Parameter #0 [ SapiResponseInterface $response ] } + - Return [ void ] } - Method [ protected method sendHeaders ] { + Method [ public method sendCookies ] { - - Parameters [0] { + - Parameters [1] { + Parameter #0 [ SapiResponseInterface $response ] } + - Return [ void ] } - Method [ protected method sendCookies ] { + Method [ public method sendContent ] { - - Parameters [0] { + - Parameters [1] { + Parameter #0 [ SapiResponseInterface $response ] } + - Return [ void ] } + } + } - Method [ protected method sendContent ] { + Class [ class SapiUpload ] { - - Parameters [0] { + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [6] { + Property [ private $isUnconstructed ] + Property [ public $name ] + Property [ public $type ] + Property [ public $size ] + Property [ public $tmpName ] + Property [ public $error ] + } + + - Methods [2] { + Method [ public method __construct ] { + + - Parameters [5] { + Parameter #0 [ string or NULL $name ] + Parameter #1 [ string or NULL $type ] + Parameter #2 [ int or NULL $size ] + Parameter #3 [ string or NULL $tmpName ] + Parameter #4 [ int or NULL $error ] + } + } + + Method [ public method move ] { + + - Parameters [1] { + Parameter #0 [ string $destination ] } } } diff --git a/php-pecl-request.spec b/php-pecl-request.spec index 0d8fdeb..9ebb8c4 100644 --- a/php-pecl-request.spec +++ b/php-pecl-request.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-request # -# Copyright (c) 2016-2019 Remi Collet +# Copyright (c) 2016-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -14,21 +14,18 @@ %global pecl_name request %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global ini_name 40-%{pecl_name}.ini -%global prever b2 +#global prever b2 Summary: Server-side request and response objects Name: %{?sub_prefix}php-pecl-%{pecl_name} -Version: 1.0.0 -Release: 0.11.%{prever}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Version: 2.0.0 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: PHP -URL: http://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz - -Patch0: https://patch-diff.githubusercontent.com/raw/pmjones/ext-request/pull/12.patch -Patch1: https://patch-diff.githubusercontent.com/raw/pmjones/ext-request/pull/14.patch +URL: https://pecl.php.net/package/%{pecl_name} +Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz BuildRequires: %{?dtsprefix}gcc -BuildRequires: %{?scl_prefix}php-devel > 7 +BuildRequires: %{?scl_prefix}php-devel > 7.3 BuildRequires: %{?scl_prefix}php-pear BuildRequires: %{?scl_prefix}php-json @@ -54,20 +51,16 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{rele %if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff -Obsoletes: php70u-pecl-%{pecl_name} <= %{version} -Obsoletes: php70w-pecl-%{pecl_name} <= %{version} -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.2" Obsoletes: php72u-pecl-%{pecl_name} <= %{version} Obsoletes: php72w-pecl-%{pecl_name} <= %{version} -%endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif +%if "%{php_version}" > "7.4" +Obsoletes: php74-pecl-%{pecl_name} <= %{version} +Obsoletes: php74w-pecl-%{pecl_name} <= %{version} +%endif %endif %if 0%{?fedora} < 20 && 0%{?rhel} < 7 @@ -79,25 +72,36 @@ Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %description This extension provides server-side request and response objects for PHP. -These are *not* HTTP message objects proper. They are more like wrappers -for existing global PHP variables and functions, with some limited -additional convenience functionality. -This extension defines two classes in the global namespace: +These are *not* HTTP message objects proper. They are more like wrappers +for existing global PHP variables and functions. -- ServerRequest, composed of read-only copies of PHP superglobals and some - other commonly-used values, with methods for adding application-specific - request information in immutable fashion. +Four classes and one interface are defined in the global namespace: -- ServerResponse, essentially a wrapper around (and buffer for) response- - related PHP functions, with some additional convenience methods, and self- - sending capability. +- SapiRequest, composed of read-only copies of PHP superglobals and + some other commonly-used values. +- SapiUpload, a value-object style descriptor of each uploaded file. +- SapiResponse and SapiResponseInterface, essentially a wrapper around + (and buffer for) response-related PHP functions. +- SapiResponseSender, for sending a SapiResponse. Documentation: https://gitlab.com/pmjones/phprequest Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. +%package devel +Summary: %{name} developer files (header) +Group: Development/Libraries +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: %{?scl_prefix}php-devel%{?_isa} +Provides: %{?scl_prefix}php-pecl-%{pecl_name}-devel = %{version}-%{release} +Provides: %{?scl_prefix}php-pecl-%{pecl_name}-devel%{?_isa} = %{version}-%{release} + +%description devel +These are the files needed to compile programs using %{name}. + + %prep %setup -q -c mv %{pecl_name}-%{version}%{?prever} NTS @@ -108,9 +112,6 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -%patch0 -p1 -b .pr12 -%patch1 -p1 -b .pr14 - # Sanity check, really often broken extver=$(sed -n '/define PHP_REQUEST_VERSION/{s/.* "//;s/".*$//;p}' php_request.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -178,6 +179,9 @@ for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done +mkdir -p %{buildroot}%{pecl_testdir}/%{pecl_name} +cp -pr tests %{buildroot}%{pecl_testdir}/%{pecl_name}/tests + %if 0%{?fedora} < 24 && 0%{?rhel} < 8 # when pear installed alone, after us @@ -200,6 +204,12 @@ fi %check +# CGI tests +find ?TS/tests \ + -name \*.phpt \ + -exec grep -qE '^--(POST_RAW|CGI)--$' {} \; \ + -delete + : Minimal load test for NTS extension cd NTS %{_bindir}/php --no-php-ini \ @@ -217,6 +227,11 @@ REPORT_EXIT_STATUS=1 \ %if %{with_zts} : Minimal load test for ZTS extension cd ../ZTS +# failing for ZTS +rm tests/request/cookie.phpt +rm tests/request/input.phpt +rm tests/request/query.phpt +rm tests/request/variables_order.phpt %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ @@ -244,8 +259,21 @@ REPORT_EXIT_STATUS=1 \ %{php_ztsextdir}/%{pecl_name}.so %endif +%files devel +%doc %{pecl_testdir}/%{pecl_name} +%{php_incldir}/ext/%{pecl_name} + +%if %{with_zts} +%{php_ztsincldir}/ext/%{pecl_name} +%endif + %changelog +* Wed Apr 8 2020 Remi Collet - 2.0.0-1 +- update to 2.0.0 +- raise dependency on PHP 7.3 +- add devel sub-package + * Tue Aug 27 2019 Remi Collet - 1.0.0-0.11.b2 - add build dependency on php-json -- cgit