From: Michael Wallner Date: Wed, 8 Jun 2022 15:22:34 +0000 (+0200) Subject: Backport v4 updates X-Git-Tag: v4.2.3~4^2 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=commitdiff_plain;h=e3976774f27b4129cbfd7d227aaa7e177f1b735c;hp=29bdc7039ca5ffe71c465d957da9922881b6859d Backport v4 updates --- diff --git a/.github/Makefile b/.github/Makefile deleted file mode 100644 index 29166f3..0000000 --- a/.github/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY: all -all: workflows/ci.yml -all: workflows/curl-matrix.yml - -workflows/%.yml: ../scripts/gen_github_workflow_%.php - $<>$@ - -workflows/curl-matrix.yml: ../scripts/curlver.dist diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ed701c..9345091 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,14 +7,15 @@ on: pull_request: jobs: - next-0: - name: "next-0 (8.1)" + old-matrix-0: + name: old-matrix-0 env: - PHP: "8.1" + PHP: "7.0" enable_debug: "yes" - enable_zts: "yes" + enable_maintainer_zts: "yes" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" - TEST_PHP_ARGS: "-d error_reporting=24575" runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -26,6 +27,101 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Prepare + run: | + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + + - name: Build + run: | + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + make -f scripts/ci/Makefile test + + old-matrix-1: + name: old-matrix-1 + env: + PHP: "7.1" + enable_debug: "yes" + enable_maintainer_zts: "yes" + enable_json: "yes" + enable_hash: "yes" + enable_iconv: "yes" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Install + run: | + sudo apt-get install -y \ + php-cli \ + php-pear \ + libcurl4-openssl-dev \ + libevent-dev \ + libidn11-dev \ + libidn2-0-dev \ + libicu-dev \ + libevent-dev \ + libbrotli-dev \ + re2c + - name: Prepare + run: | + make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + + - name: Build + run: | + make -f scripts/ci/Makefile ext PECL=http + - name: Test + run: | + make -f scripts/ci/Makefile test + + old-matrix-2: + name: old-matrix-2 + env: + PHP: "7.2" + enable_debug: "yes" + enable_maintainer_zts: "yes" + enable_json: "yes" + enable_hash: "yes" + enable_iconv: "yes" + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Install + run: | + sudo apt-get install -y \ + php-cli \ + php-pear \ + libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -36,6 +132,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -43,15 +148,15 @@ jobs: run: | make -f scripts/ci/Makefile test - next-1: - name: "next-1 (master)" - continue-on-error: true + old-matrix-3: + name: old-matrix-3 env: - PHP: "master" + PHP: "7.3" enable_debug: "yes" - enable_zts: "yes" + enable_maintainer_zts: "yes" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" - TEST_PHP_ARGS: "-d error_reporting=24575" runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -63,6 +168,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -73,6 +179,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -81,9 +196,9 @@ jobs: make -f scripts/ci/Makefile test cur-none-0: - name: "cur-none-0 (8.0)" + name: cur-none-0 env: - PHP: "8.0" + PHP: "7.4" with_http_libicu_dir: "no" with_http_libidn_dir: "no" with_http_libidn2_dir: "no" @@ -101,6 +216,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -111,6 +227,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -119,11 +244,15 @@ jobs: make -f scripts/ci/Makefile test cur-dbg-zts-0: - name: "cur-dbg-zts-0 (8.0)" + name: cur-dbg-zts-0 env: - PHP: "8.0" + PHP: "7.4" + PECLs: "event" + enable_sockets: "yes" enable_debug: "yes" - enable_zts: "yes" + enable_maintainer_zts: "yes" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" runs-on: ubuntu-20.04 steps: @@ -136,6 +265,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -146,6 +276,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -154,11 +293,15 @@ jobs: make -f scripts/ci/Makefile test cur-dbg-zts-1: - name: "cur-dbg-zts-1 (8.0)" + name: cur-dbg-zts-1 env: - PHP: "8.0" + PHP: "7.4" + PECLs: "event" + enable_sockets: "yes" enable_debug: "no" - enable_zts: "yes" + enable_maintainer_zts: "yes" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" runs-on: ubuntu-20.04 steps: @@ -171,6 +314,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -181,6 +325,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -189,11 +342,15 @@ jobs: make -f scripts/ci/Makefile test cur-dbg-zts-2: - name: "cur-dbg-zts-2 (8.0)" + name: cur-dbg-zts-2 env: - PHP: "8.0" + PHP: "7.4" + PECLs: "event" + enable_sockets: "yes" enable_debug: "yes" - enable_zts: "no" + enable_maintainer_zts: "no" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" runs-on: ubuntu-20.04 steps: @@ -206,6 +363,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -216,6 +374,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -224,11 +391,15 @@ jobs: make -f scripts/ci/Makefile test cur-dbg-zts-3: - name: "cur-dbg-zts-3 (8.0)" + name: cur-dbg-zts-3 env: - PHP: "8.0" + PHP: "7.4" + PECLs: "event" + enable_sockets: "yes" enable_debug: "no" - enable_zts: "no" + enable_maintainer_zts: "no" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" runs-on: ubuntu-20.04 steps: @@ -241,6 +412,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -251,6 +423,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -259,11 +440,15 @@ jobs: make -f scripts/ci/Makefile test cur-cov-0: - name: "cur-cov-0 (8.0)" + name: cur-cov-0 env: CFLAGS: "-O0 -g --coverage" CXXFLAGS: "-O0 -g --coverage" - PHP: "8.0" + PHP: "7.4" + PECLs: "event" + enable_sockets: "yes" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" with_http_libicu_dir: "yes" with_http_libidn_dir: "no" @@ -279,6 +464,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -289,6 +475,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -302,11 +497,15 @@ jobs: bash <(curl -s https://codecov.io/bash) -X xcode -X coveragepy cur-cov-1: - name: "cur-cov-1 (8.0)" + name: cur-cov-1 env: CFLAGS: "-O0 -g --coverage" CXXFLAGS: "-O0 -g --coverage" - PHP: "8.0" + PHP: "7.4" + PECLs: "event" + enable_sockets: "yes" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" with_http_libicu_dir: "no" with_http_libidn_dir: "yes" @@ -322,6 +521,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -332,6 +532,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http @@ -345,11 +554,15 @@ jobs: bash <(curl -s https://codecov.io/bash) -X xcode -X coveragepy cur-cov-2: - name: "cur-cov-2 (8.0)" + name: cur-cov-2 env: CFLAGS: "-O0 -g --coverage" CXXFLAGS: "-O0 -g --coverage" - PHP: "8.0" + PHP: "7.4" + PECLs: "event" + enable_sockets: "yes" + enable_json: "yes" + enable_hash: "yes" enable_iconv: "yes" with_http_libicu_dir: "no" with_http_libidn_dir: "no" @@ -365,6 +578,7 @@ jobs: php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -375,6 +589,15 @@ jobs: run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http diff --git a/.github/workflows/curl-matrix.yml b/.github/workflows/curl-matrix.yml deleted file mode 100644 index d66ecec..0000000 --- a/.github/workflows/curl-matrix.yml +++ /dev/null @@ -1,1109 +0,0 @@ -# generated file; do not edit! - -name: curl-matrix -on: - workflow_dispatch: - push: - -jobs: - curl-master: - name: curl-master - continue-on-error: true - env: - PHP: "8.0" - CURL: "master" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_81_0: - name: curl-7_81_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_81_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_81_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_80_0: - name: curl-7_80_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_80_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_80_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_79_1: - name: curl-7_79_1 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_79_1" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_79_1 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_78_0: - name: curl-7_78_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_78_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_78_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_76_1: - name: curl-7_76_1 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_76_1" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_76_1 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_74_0: - name: curl-7_74_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_74_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_74_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_71_1: - name: curl-7_71_1 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_71_1" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_71_1 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_68_0: - name: curl-7_68_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_68_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_68_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_67_0: - name: curl-7_67_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_67_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_67_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_64_0: - name: curl-7_64_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_64_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_64_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_61_1: - name: curl-7_61_1 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_61_1" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_61_1 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_58_0: - name: curl-7_58_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_58_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_58_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_52_1: - name: curl-7_52_1 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_52_1" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_52_1 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_49_1: - name: curl-7_49_1 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_49_1" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_49_1 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_31_0: - name: curl-7_31_0 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_31_0" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_31_0 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_20_1: - name: curl-7_20_1 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_20_1" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_20_1 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_19_7: - name: curl-7_19_7 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_19_7" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_19_7 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - - curl-7_18_2: - name: curl-7_18_2 - continue-on-error: true - env: - PHP: "8.0" - CURL: "7_18_2" - enable_debug: "yes" - enable_iconv: "yes" - with_http_libcurl_dir: "/opt" - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - ref: curl-7_18_2 # - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - diff --git a/.gitignore b/.gitignore index a20dd1d..5ebf7aa 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,4 @@ vendor/ /tests/helper/server.log *gcov *lcov +*.loT diff --git a/CHANGELOG.md b/CHANGELOG.md index 571b488..b76f56d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,72 +1,193 @@ -# ChangeLog v4 +# ChangeLog v3 -## 4.2.2, 2022-02-25 +## 3.2.5, 2022-02-25 * Fixed gh-issue #123: Segfault with libcurl 7.81 -## 4.2.1, 2021-09-13 - -* Fixed failing tests with PHP-8.1 (see gh issue #120) -* Fixed configure reliably finding the right libcurl features available -* Fixed cookie handling with libcurl 7.77+ and consistently across all - supported libcurl versions (follow-up to gh issue #116) - -## 4.2.0, 2021-08-30 - -* Fixed PHP-8.1 compatibility (see gh issues #114, #115 and #118) -* Fixed cookies failing with libcurl >= 7.77 (see gh issue #116) -* Fixed tests using $_ENV instead of getenv() to find executables in PATH (see gh issue #113) -* Added http\Env::reset(): resets internal HTTP request cache (see gh issue #90) - -## 4.1.0, 2021-04-21 - -* Added request options: - * http\Client\Curl::$abstract_unix_socket - * http\Client\Curl::$altsvc - * http\Client\Curl::$altsvc_ctrl - * http\Client\Curl::$aws_sigv4 - * http\Client\Curl::$doh_url - * http\Client\Curl::$dns_shuffle_addresses - * http\Client\Curl::$haproxy_protocol - * http\Client\Curl::$hsts - * http\Client\Curl::$hsts_ctrl - * http\Client\Curl::$http09_allowed - * http\Client\Curl::$maxage_conn - * http\Client\Curl::$pinned_publickey - * http\Client\Curl::$proxy_ssl - * http\Client\Curl::$socks5_auth - * http\Client\Curl::$tcp_fastopen - * http\Client\Curl::$tls13_ciphers - * http\Client\Curl::$xoauth2_bearer -* Added request option constants: - * http\Client\Curl\AUTH_AWS_SIGV4 - * http\Client\Curl\AUTH_BEARER - * http\Client\Curl\AUTH_NONE - * http\Client\Curl\HTTP_VERSION_2_PRIOR_KNOWLEDGE - * http\Client\Curl\HTTP_VERSION_3 - * http\Client\Curl\SSL_VERSION_MAX_* - * http\Client\Curl\SSL_VERSION_TLSv1_3 -* Added library version constants: - * http\Client\Curl\Versions\BROTLI - * http\Client\Curl\Versions\CAINFO - * http\Client\Curl\Versions\CAPATH - * http\Client\Curl\Versions\HYPER - * http\Client\Curl\Versions\ICONV - * http\Client\Curl\Versions\NGHTTP2 - * http\Client\Curl\Versions\QUIC - * http\Client\Curl\Versions\ZSTD - -## 4.0.0, 2021-01-13 +## 3.2.4, 2021-01-13 -Changes from beta1: * Fixed configure on systems which do not provide icu-config * Fixed gh-issue #89: Cookie handling cannot be disabled since v3.2.1 -## 4.0.0beta1, 2020-09-23 +## 3.2.3, 2019-10-29 + +* Fixed Windows build (Jan Ehrhardt) + +## 3.2.2, 2019-10-24 + +* PHP-7.4 compatibility +* Fixed gh-issue #92: http\Message\Body::addForm() discards numeric names +* Fixed gh-issue #95: typo in http\Message::getResponseCode()'s error message + +## 3.2.1, 2019-06-07 + +* Fixed gh-issue #88: Unable to run test suite (Remi Collet) +* Fixed gh-issue #86: test failure with curl 7.64 +* Fixed gh-issue #85: [-Wformat-extra-args] build warnings +* Fixed gh-issue #84: segfault and build failure since curl 7.62 +* Fixed gh-issue #82: Test harness improvements (Chris Wright) +* Fixed gh-issue #64: compress and connecttimeout interfere with low_speed_limit (@rcanavan) +* Fixed http\QueryString::getGlobalInstance() +* Fixed missing 2nd reflection argument info of http\Client::notify() +* Fixed PHP-7.4 compatibility + +## 3.2.0, 2018-07-19 + +* PHP-7.2 compatibility +* Fixed gh-issue #73: build fails with libidn and libidn2 ++ Added brotli compression support ++ Implemented gh-issue #58: Notify observers before any request is built + +Changes from RC1: +* Fixed gh-issue #78: PHP-7.3 build crashes + +## 3.2.0RC1, 2018-04-09 + +* PHP-7.2 compatibility +* Fixed gh-issue #73: build fails with libidn and libidn2 ++ Added brotli compression support ++ Implemented gh-issue #58: Notify observers before any request is built + +## 3.1.0, 2016-12-12 + ++ Added http\Client\Curl\User interface for userland event loops ++ Added http\Url::IGNORE_ERRORS, http\Url::SILENT_ERRORS and http\Url::STDFLAGS ++ Added http\Client::setDebug(callable $debug) ++ Added http\Client\Curl\FEATURES constants and namespace ++ Added http\Client\Curl\VERSIONS constants and namespace ++ Added share_cookies and share_ssl (libcurl >= 7.23.0) options to http\Client::configure() ++ http\Client uses curl_share handles to properly share cookies and SSL/TLS sessions between requests ++ Improved configure checks for default CA bundles ++ Improved negotiation precision +* Fixed regression introduced by http\Params::PARSE_RFC5987: negotiation using the params parser would receive param keys without the trailing asterisk, stripped by http\Params::PARSE_RFC5987. +* Fix gh-issue #50: http\Client::dequeue() within http\Client::setDebug() causes segfault (Mike, Maik Wagner) +* Fix gh-issue #47: http\Url: Null pointer deref in sanitize_value() (Mike, @rc0r) +* Fix gh-issue #45: HTTP/2 response message parsing broken with libcurl >= 7.49.1 (Mike) +* Fix gh-issue #43: Joining query with empty original variable in query (Mike, Sander Backus) +* Fix gh-issue #42: fatal error when using punycode in URLs (Mike, Sebastian Thielen) +* Fix gh-issue #41: Use curl_version_info_data.features when initializing options (Mike) +* Fix gh-issue #40: determinde the SSL backend used by curl at runtime (Mike, @rcanavan) +* Fix gh-issue #39: Notice: http\Client::enqueue(): Could not set option proxy_service_name (Mike, @rcanavan) +* Fix gh-issue #38: Persistent curl handles: error code not properly reset (Mike, @afflerbach) +* Fix gh-issue #36: Unexpected cookies sent if persistent_handle_id is used (Mike, @rcanavan, @afflerbach) +* Fix gh-issue #34: allow setting multiple headers with the same name (Mike, @rcanavan) +* Fix gh-issue #33: allow setting prodyhost request option to NULL (Mike, @rcanavan) +* Fix gh-issue #31: add/improve configure checks for default CA bundle/path (Mike, @rcanavan) + +Changes from beta1: +* Fixed recursive calls to the event loop dispatcher + +Changes from beta2: ++ Improved configure checks for IDNA libraries (added --with-http-libicu-dir, --with-http-libidnkit{,2}-dir, --with-http-libidn2-dir) +* Fix bug #73055: crash in http\QueryString (Mike, @rc0r) (CVE-2016-7398) +* Fix bug #73185: Buffer overflow in HTTP parse_hostinfo() (Mike, @rc0r) (CVE-2016-7961) +* Fix HTTP/2 version parser for older libcurl versions (Mike) +* Fix gh-issue #52: Underscores in host names: libidn Failed to parse IDN (Mike, @canavan) + +## 3.1.0RC1, 2016-10-04 + ++ Added http\Client\Curl\User interface for userland event loops ++ Added http\Url::IGNORE_ERRORS, http\Url::SILENT_ERRORS and http\Url::STDFLAGS ++ Added http\Client::setDebug(callable $debug) ++ Added http\Client\Curl\FEATURES constants and namespace ++ Added http\Client\Curl\VERSIONS constants and namespace ++ Added share_cookies and share_ssl (libcurl >= 7.23.0) options to http\Client::configure() ++ http\Client uses curl_share handles to properly share cookies and SSL/TLS sessions between requests ++ Improved configure checks for default CA bundles ++ Improved negotiation precision +* Fixed regression introduced by http\Params::PARSE_RFC5987: negotiation using the params parser would receive param keys without the trailing asterisk, stripped by http\Params::PARSE_RFC5987. +* Fix gh-issue #50: http\Client::dequeue() within http\Client::setDebug() causes segfault (Mike, Maik Wagner) +* Fix gh-issue #47: http\Url: Null pointer deref in sanitize_value() (Mike, @rc0r) +* Fix gh-issue #45: HTTP/2 response message parsing broken with libcurl >= 7.49.1 (Mike) +* Fix gh-issue #43: Joining query with empty original variable in query (Mike, Sander Backus) +* Fix gh-issue #42: fatal error when using punycode in URLs (Mike, Sebastian Thielen) +* Fix gh-issue #41: Use curl_version_info_data.features when initializing options (Mike) +* Fix gh-issue #40: determinde the SSL backend used by curl at runtime (Mike, @rcanavan) +* Fix gh-issue #39: Notice: http\Client::enqueue(): Could not set option proxy_service_name (Mike, @rcanavan) +* Fix gh-issue #38: Persistent curl handles: error code not properly reset (Mike, @afflerbach) +* Fix gh-issue #36: Unexpected cookies sent if persistent_handle_id is used (Mike, @rcanavan, @afflerbach) +* Fix gh-issue #34: allow setting multiple headers with the same name (Mike, @rcanavan) +* Fix gh-issue #33: allow setting prodyhost request option to NULL (Mike, @rcanavan) +* Fix gh-issue #31: add/improve configure checks for default CA bundle/path (Mike, @rcanavan) + +Changes from beta1: +* Fixed recursive calls to the event loop dispatcher + +Changes from beta2: ++ Improved configure checks for IDNA libraries (added --with-http-libicu-dir, --with-http-libidnkit{,2}-dir, --with-http-libidn2-dir) +* Fix bug #73055: crash in http\QueryString (Mike, @rc0r) (CVE-2016-7398) +* Fix bug #73185: Buffer overflow in HTTP parse_hostinfo() (Mike, @rc0r) (CVE-2016-7961) +* Fix HTTP/2 version parser for older libcurl versions (Mike) +* Fix gh-issue #52: Underscores in host names: libidn Failed to parse IDN (Mike, @canavan) + +## 3.1.0beta2, 2016-09-07 + ++ Added http\Client\Curl\User interface for userland event loops ++ Added http\Url::IGNORE_ERRORS, http\Url::SILENT_ERRORS and http\Url::STDFLAGS ++ Added http\Client::setDebug(callable $debug) ++ Added http\Client\Curl\FEATURES constants and namespace ++ Added http\Client\Curl\VERSIONS constants and namespace ++ Added share_cookies and share_ssl (libcurl >= 7.23.0) options to http\Client::configure() ++ http\Client uses curl_share handles to properly share cookies and SSL/TLS sessions between requests ++ Improved configure checks for default CA bundles ++ Improved negotiation precision +* Fixed regression introduced by http\Params::PARSE_RFC5987: negotiation using the params parser would receive param keys without the trailing asterisk, stripped by http\Params::PARSE_RFC5987. +* Fix gh-issue #50: http\Client::dequeue() within http\Client::setDebug() causes segfault (Mike, Maik Wagner) +* Fix gh-issue #47: http\Url: Null pointer deref in sanitize_value() (Mike, @rc0r) +* Fix gh-issue #45: HTTP/2 response message parsing broken with libcurl >= 7.49.1 (Mike) +* Fix gh-issue #43: Joining query with empty original variable in query (Mike, Sander Backus) +* Fix gh-issue #42: fatal error when using punycode in URLs (Mike, Sebastian Thielen) +* Fix gh-issue #41: Use curl_version_info_data.features when initializing options (Mike) +* Fix gh-issue #40: determinde the SSL backend used by curl at runtime (Mike, @rcanavan) +* Fix gh-issue #39: Notice: http\Client::enqueue(): Could not set option proxy_service_name (Mike, @rcanavan) +* Fix gh-issue #38: Persistent curl handles: error code not properly reset (Mike, @afflerbach) +* Fix gh-issue #36: Unexpected cookies sent if persistent_handle_id is used (Mike, @rcanavan, @afflerbach) +* Fix gh-issue #34: allow setting multiple headers with the same name (Mike, @rcanavan) +* Fix gh-issue #33: allow setting prodyhost request option to NULL (Mike, @rcanavan) +* Fix gh-issue #31: add/improve configure checks for default CA bundle/path (Mike, @rcanavan) + +Changes from beta1: +* Fixed recursive calls to the event loop dispatcher + +## 3.1.0beta1, 2016-08-22 + ++ Added http\Client\Curl\User interface for userland event loops ++ Added http\Url::IGNORE_ERRORS, http\Url::SILENT_ERRORS and http\Url::STDFLAGS ++ Added http\Client::setDebug(callable $debug) ++ Added http\Client\Curl\FEATURES constants and namespace ++ Added http\Client\Curl\VERSIONS constants and namespace ++ Added share_cookies and share_ssl (libcurl >= 7.23.0) options to http\Client::configure() ++ http\Client uses curl_share handles to properly share cookies and SSL/TLS sessions between requests ++ Improved configure checks for default CA bundles ++ Improved negotiation precision +* Fixed regression introduced by http\Params::PARSE_RFC5987: negotiation using the params parser would receive param keys without the trailing asterisk, stripped by http\Params::PARSE_RFC5987. +* Fix gh-issue #50: http\Client::dequeue() within http\Client::setDebug() causes segfault (Mike, Maik Wagner) +* Fix gh-issue #47: http\Url: Null pointer deref in sanitize_value() (Mike, @rc0r) +* Fix gh-issue #45: HTTP/2 response message parsing broken with libcurl >= 7.49.1 (Mike) +* Fix gh-issue #43: Joining query with empty original variable in query (Mike, Sander Backus) +* Fix gh-issue #42: fatal error when using punycode in URLs (Mike, Sebastian Thielen) +* Fix gh-issue #41: Use curl_version_info_data.features when initializing options (Mike) +* Fix gh-issue #40: determinde the SSL backend used by curl at runtime (Mike, @rcanavan) +* Fix gh-issue #39: Notice: http\Client::enqueue(): Could not set option proxy_service_name (Mike, @rcanavan) +* Fix gh-issue #38: Persistent curl handles: error code not properly reset (Mike, @afflerbach) +* Fix gh-issue #36: Unexpected cookies sent if persistent_handle_id is used (Mike, @rcanavan, @afflerbach) +* Fix gh-issue #34: allow setting multiple headers with the same name (Mike, @rcanavan) +* Fix gh-issue #33: allow setting prodyhost request option to NULL (Mike, @rcanavan) +* Fix gh-issue #31: add/improve configure checks for default CA bundle/path (Mike, @rcanavan) + +## 3.0.1, 2016-03-09 + +* Fix php-bug #71719: Buffer overflow in HTTP url parsing functions (Mike, rc0r) +* Fix gh-issue #28: Possible null pointer dereference in php_http_url_mod() (rc0r) +* Fix gh-issue #21: Fix PHP7 config.w32 (Jan Ehrhardt) +* Fix gh-issue #20: setSslOptions notice with curl 7.43 (Mike, Vitaliy Demidov) + +## 3.0.0, 2016-01-19 + +PHP7 compatible release based on the 2.5.x series with the following backwards incompatible changes: +- removed http\Url::FROM_ENV from the default flags of the http\Url constructor, use http\Env\Url instead + +## 3.0.0RC1, 2015-12-07 -* PHP 8 compatibility - - Drop ext-propro support: - PHP 8 removes the object get/set API from the ZendEngine, which renders - that extension dysfunctional. As a consequence, the header property of - http\Message and derived classes cannot be modified in place, and thus - by reference. +PHP7 compatible release based on the 2.5.x series with the following backwards incompatible changes: +- removed http\Url::FROM_ENV from the default flags of the http\Url constructor, use http\Env\Url instead diff --git a/README.md b/README.md index d4fb448..315a6d5 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ext-http -[![Build Status](https://github.com/m6w6/ext-http/workflows/ci/badge.svg?branch=master)](https://github.com/m6w6/ext-http/actions?query=workflow%3Aci+branch%3Amaster) +[![Build Status](https://github.com/m6w6/ext-http/workflows/ci/badge.svg?branch=v3.x)](https://github.com/m6w6/ext-http/actions?query=branch%3Av3.x+workflow%3Aci) [![Coverity Scan Build Status](https://scan.coverity.com/projects/8711/badge.svg)](https://scan.coverity.com/projects/m6w6-ext-http) [![codecov](https://codecov.io/gh/m6w6/ext-http/branch/master/graph/badge.svg)](https://codecov.io/gh/m6w6/ext-http) diff --git a/config.w32 b/config.w32 index 3cc4069..68006df 100644 --- a/config.w32 +++ b/config.w32 @@ -125,12 +125,14 @@ if (PHP_HTTP != "no") { CHECK_LIB("libcrypto.lib;libeay32.lib", "http", PHP_HTTP) && CHECK_LIB("crypt32.lib;libeay32.lib", "http", PHP_HTTP) && CHECK_LIB("zlib.lib;zlib_a.lib", "http", PHP_HTTP) && + ADD_EXTENSION_DEP("http", "propro", true) && ADD_EXTENSION_DEP("http", "raphf", true) && CHECK_LIB("winmm.lib", "http", PHP_HTTP)) { AC_DEFINE("PHP_HTTP_HAVE_LIBCURL", 1, "Have CURL library"); AC_DEFINE("PHP_HTTP_HAVE_SSL", 1, "Have SSL"); AC_DEFINE("PHP_HTTP_HAVE_LIBCURL_SSL", 1); AC_DEFINE("PHP_HTTP_HAVE_LIBCURL_OPENSSL", 1); + AC_DEFINE("PHP_HTTP_HAVE_EXT_PROPRO", 1, ""); AC_DEFINE("PHP_HTTP_HAVE_EXT_RAPHF", 1, ""); AC_DEFINE("PHP_HTTP_HAVE_CLIENT", 1, "Have HTTP client support"); AC_DEFINE("PHP_HAVE_CURL_MULTI_STRERROR", 1, ""); diff --git a/config9.m4 b/config9.m4 index 695701b..89d7b28 100644 --- a/config9.m4 +++ b/config9.m4 @@ -169,6 +169,12 @@ if test "$PHP_HTTP" != "no"; then ], [ AC_MSG_ERROR([please install and enable pecl/raphf]) ]) + PECL_HAVE_PHP_EXT([propro], [ + PECL_HAVE_PHP_EXT_HEADER([propro]) + ], [ + AC_MSG_ERROR([please install and enable pecl/propro]) + ]) + PECL_HAVE_PHP_EXT([hash]) PECL_HAVE_PHP_EXT([iconv]) dnl DONE @@ -198,6 +204,7 @@ if test "$PHP_HTTP" != "no"; then fi fi PHP_ADD_EXTENSION_DEP([http], [raphf], true) + PHP_ADD_EXTENSION_DEP([http], [propro], true) PHP_SUBST(PECL_VAR([HEADERS])) PHP_SUBST(PECL_VAR([SOURCES])) diff --git a/package.xml b/package.xml index 2c8b432..0576cf2 100644 --- a/package.xml +++ b/package.xml @@ -31,10 +31,10 @@ https://mdref.m6w6.name/http mike@php.net yes - 2022-02-25 + 2022-06-10 - 4.2.2 - 4.2.0 + 3.3.0 + 3.3.0 stable @@ -42,7 +42,7 @@ https://mdref.m6w6.name/http BSD-2-Clause @@ -307,6 +307,7 @@ https://mdref.m6w6.name/http + @@ -348,6 +349,8 @@ https://mdref.m6w6.name/http + + @@ -375,11 +378,9 @@ https://mdref.m6w6.name/http - - @@ -387,7 +388,9 @@ https://mdref.m6w6.name/http - 8.0.0 + 7.0.0 + 8.0.0 + 8.0.0 1.4.1 @@ -398,6 +401,12 @@ https://mdref.m6w6.name/http 2.0.0dev raphf + + propro + pecl.php.net + 2.0.0dev + propro + hash diff --git a/php_http.h b/php_http.h index f4b4b33..d57f6e4 100644 --- a/php_http.h +++ b/php_http.h @@ -13,7 +13,7 @@ #ifndef PHP_EXT_HTTP_H #define PHP_EXT_HTTP_H -#define PHP_PECL_HTTP_VERSION "4.2.2" +#define PHP_PECL_HTTP_VERSION "3.3.0dev" extern zend_module_entry http_module_entry; #define phpext_http_ptr &http_module_entry diff --git a/scripts/curlver.dist b/scripts/curlver.dist deleted file mode 100644 index 829777b..0000000 --- a/scripts/curlver.dist +++ /dev/null @@ -1,17 +0,0 @@ -# current is 7.81.0 ATM -# 7.21.5-7.29.0 fail to configure on gh actions - -alpine: 7.78.0 7.67.0 -centos: 7.61.1 # 7.29.0 -debian: 7.74.0 7.64.0 7.52.1 -fedora: 7.78.0 7.76.1 7.71.1 -other: 7.49.1 7.31.0 -ubuntu: 7.74.0 7.68.0 7.58.0 - -# always test against a few recent -latest: master 7.81.0 7.80.0 7.79.1 -# and a couple ancient -oldest: 7.18.2 7.19.7 7.20.1 - -# 7.64.1 fails client tests because of superfluous infof() calls -# 7.64.0 fails client cookie test because of curl/curl#3613 diff --git a/scripts/gen_github_workflow_ci.php b/scripts/gen_github_workflow_ci.php index c23f23e..dc6ea6b 100755 --- a/scripts/gen_github_workflow_ci.php +++ b/scripts/gen_github_workflow_ci.php @@ -11,49 +11,58 @@ jobs: github([ -"next" => [ +"old-matrix" => [ // most useful for all additional versions except current - "PHP" => ["8.1", "master"], - "enable_debug" => "yes", - "enable_zts" => "yes", - "enable_iconv" => "yes", - "TEST_PHP_ARGS" => "-d error_reporting=24575" // ignore E_DEPRECATED -], + "PHP" => ["7.0", "7.1", "7.2", "7.3"], + "enable_debug" => "yes", + "enable_maintainer_zts" => "yes", + "enable_json" => "yes", + "enable_hash" => "yes", + "enable_iconv" => "yes", +], "cur-none" => [ // everything disabled for current - "PHP" => $cur, - "with_http_libicu_dir" => "no", - "with_http_libidn_dir" => "no", - "with_http_libidn2_dir" => "no", - "with_http_libcurl_dir" => "no", - "with_http_libevent_dir" => "no", - "with_http_libbrotli_dir" => "no", -], + "PHP" => $cur, + "with_http_libicu_dir" => "no", + "with_http_libidn_dir" => "no", + "with_http_libidn2_dir" => "no", + "with_http_libcurl_dir" => "no", + "with_http_libevent_dir" => "no", + "with_http_libbrotli_dir" => "no", +], "cur-dbg-zts" => [ // everything enabled for current, switching debug/zts - "PHP" => $cur, - "enable_debug", - "enable_zts", - "enable_iconv" => "yes", -], + "PHP" => $cur, + "PECLs" => "event", // for tests/client029.phpt + "enable_sockets" => "yes", // needed by pecl/event + "enable_debug", + "enable_maintainer_zts", + "enable_json" => "yes", + "enable_hash" => "yes", + "enable_iconv" => "yes", +], "cur-cov" => [ // once everything enabled for current, with coverage - "CFLAGS" => "-O0 -g --coverage", - "CXXFLAGS" => "-O0 -g --coverage", - "PHP" => $cur, - "enable_iconv" => "yes", - [ - // mutually exclusive - "with_http_libicu_dir", - "with_http_libidn_dir", - "with_http_libidn2_dir", - ], + "CFLAGS" => "-O0 -g --coverage", + "CXXFLAGS" => "-O0 -g --coverage", + "PHP" => $cur, + "PECLs" => "event", // for tests/client029.phpt + "enable_sockets" => "yes", // needed by pecl/event + "enable_json" => "yes", + "enable_hash" => "yes", + "enable_iconv" => "yes", + [ + "with_http_libicu_dir", + "with_http_libidn_dir", + "with_http_libidn2_dir", + ], ]]); + foreach ($job as $id => $env) { printf(" %s:\n", $id); - printf(" name: \"%s (%s)\"\n", $id, $env["PHP"]); + printf(" name: %s\n", $id); if ($env["PHP"] == "master") { printf(" continue-on-error: true\n"); } @@ -73,6 +82,7 @@ foreach ($job as $id => $env) { php-cli \ php-pear \ libcurl4-openssl-dev \ + libevent-dev \ libidn11-dev \ libidn2-0-dev \ libicu-dev \ @@ -83,6 +93,15 @@ foreach ($job as $id => $env) { run: | make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master + make -f scripts/ci/Makefile pecl PECL=m6w6/ext-propro.git:propro:master + if test -n "$PECLs"; then + IFS=$',' + for pecl in $PECLs; do + make -f scripts/ci/Makefile pecl PECL=$pecl + done + unset IFS + fi + - name: Build run: | make -f scripts/ci/Makefile ext PECL=http diff --git a/scripts/gen_github_workflow_curl-matrix.php b/scripts/gen_github_workflow_curl-matrix.php deleted file mode 100755 index 66b50c9..0000000 --- a/scripts/gen_github_workflow_curl-matrix.php +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/env php - - -name: curl-matrix -on: - workflow_dispatch: - push: - -jobs: - 1) { - $curlver = array_map(fn($v) => strtr($v, ".", "_"), array_unique(array_slice($argv, 1))); -} else { - $curlver = array_unique( - iterator_to_array( - (function() { - $split = function($sep, $subject, $def = [""]) { - return array_filter(array_map("trim", explode($sep, $subject))) + $def; - }; - foreach (file(__DIR__."/curlver.dist") as $line) { - $rec = $split(":", $split("#", $line)[0]); - if (!empty($rec[1])) foreach ($split(" ", $rec[1], []) as $dist_ver) { - yield strtr($dist_ver, ".", "_"); - } - } - })() - ) - ); -} - -rsort($curlver, SORT_NATURAL); - -$gen = include __DIR__ . "/ci/gen-matrix.php"; -$job = $gen->github([ -"curl" => [ - "PHP" => "8.0", - "CURL" => $curlver, - "enable_debug" => "yes", - "enable_iconv" => "yes", - "with_http_libcurl_dir" => "/opt", -]]); -foreach ($job as $id => $env) { - printf(" curl-%s:\n", $env["CURL"]); - printf(" name: curl-%s\n", $env["CURL"]); - printf(" continue-on-error: true\n"); - printf(" env:\n"); - foreach ($env as $key => $val) { - printf(" %s: \"%s\"\n", $key, $val); - } -?> - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: true - path: http - - uses: actions/checkout@v2 - with: - repository: curl/curl - path: curl - - ref: curl- # - - - name: Install - run: | - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic main' | sudo tee -a /etc/apt/sources.list && \ - echo 'deb-src http://azure.archive.ubuntu.com/ubuntu bionic-updates main' | sudo tee -a /etc/apt/sources.list && \ - sudo apt-get update -y && \ - sudo apt-get build-dep -y libcurl4-openssl-dev && \ - sudo apt-get install -y \ - php-cli \ - php-pear \ - libidn11-dev \ - libidn2-0-dev \ - libicu-dev \ - libevent-dev \ - libbrotli-dev \ - re2c - - name: Curl - run: | - sudo chmod +x /usr/share/libtool/build-aux/ltmain.sh - sudo ln -s /usr/share/libtool/build-aux/ltmain.sh /usr/bin/libtool - cd curl - ./buildconf - ./configure --prefix=/opt --disable-dependency-tracking --with-ssl --with-openssl --without-libssh2 - make -j2 - make install - - name: Prepare - run: | - cd http - make -f scripts/ci/Makefile php || make -f scripts/ci/Makefile clean php - make -f scripts/ci/Makefile pecl PECL=m6w6/ext-raphf.git:raphf:master - - name: Build - run: | - cd http - make -f scripts/ci/Makefile ext PECL=http - - name: Test - run: | - cd http - make -f scripts/ci/Makefile test - -val, key.key->len, opt, 0); } else if (is_client && (zend_string_equals_literal(key.key, "recordHistory") || zend_string_equals_literal(key.key, "responseMessageClass"))) { - zend_update_property(this_ce, Z_OBJ_P(instance), key.key->val, key.key->len, opt); + zend_update_property(this_ce, instance, key.key->val, key.key->len, opt); } else if (Z_TYPE_P(opt) == IS_NULL) { - old_opts = zend_read_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), 0, &old_opts_tmp); + old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp); if (Z_TYPE_P(old_opts) == IS_ARRAY) { zend_symtable_del(Z_ARRVAL_P(old_opts), key.key); } @@ -139,12 +139,12 @@ void php_http_client_options_set(zval *instance, zval *opts) } ZEND_HASH_FOREACH_END(); - old_opts = zend_read_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), 0, &old_opts_tmp); + old_opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &old_opts_tmp); if (Z_TYPE_P(old_opts) == IS_ARRAY) { array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL(new_opts)); } array_join(Z_ARRVAL(add_opts), Z_ARRVAL(new_opts), 0, 0); - zend_update_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), &new_opts); + zend_update_property(this_ce, instance, ZEND_STRL("options"), &new_opts); zval_ptr_dtor(&new_opts); zval_ptr_dtor(&add_opts); } @@ -153,7 +153,7 @@ void php_http_client_options_set(zval *instance, zval *opts) void php_http_client_options_get_subr(zval *instance, char *key, size_t len, zval *return_value) { zend_class_entry *this_ce = Z_OBJCE_P(instance); - zval *options, opts_tmp, *opts = zend_read_property(this_ce, Z_OBJ_P(instance), ZEND_STRL("options"), 0, &opts_tmp); + zval *options, opts_tmp, *opts = zend_read_property(this_ce, instance, ZEND_STRL("options"), 0, &opts_tmp); if ((Z_TYPE_P(opts) == IS_ARRAY) && (options = zend_symtable_str_find(Z_ARRVAL_P(opts), key, len))) { RETVAL_ZVAL(options, 1, 0); @@ -381,11 +381,11 @@ zend_object *php_http_client_object_new(zend_class_entry *ce) return &php_http_client_object_new_ex(ce, NULL)->zo; } -static HashTable *php_http_client_object_get_gc(zend_object *object, zval **table, int *n) +static HashTable *php_http_client_object_get_gc(zval *object, zval **table, int *n) { - php_http_client_object_t *obj = PHP_HTTP_OBJ(object, NULL); + php_http_client_object_t *obj = PHP_HTTP_OBJ(NULL, object); zend_llist_element *el = NULL; - HashTable *props = object->handlers->get_properties(object); + HashTable *props = Z_OBJPROP_P(object); uint32_t count = zend_hash_num_elements(props) + zend_llist_count(&obj->client->responses) + zend_llist_count(&obj->client->requests) + 2; zval *val; @@ -431,7 +431,7 @@ static HashTable *php_http_client_object_get_gc(zend_object *object, zval **tabl static void handle_history(zval *zclient, php_http_message_t *request, php_http_message_t *response) { - zval new_hist, old_hist_tmp, *old_hist = zend_read_property(php_http_client_class_entry, Z_OBJ_P(zclient), ZEND_STRL("history"), 0, &old_hist_tmp); + zval new_hist, old_hist_tmp, *old_hist = zend_read_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), 0, &old_hist_tmp); php_http_message_t *req_copy = php_http_message_copy(request, NULL); php_http_message_t *res_copy = php_http_message_copy(response, NULL); php_http_message_t *zipped = php_http_message_zip(res_copy, req_copy); @@ -443,7 +443,7 @@ static void handle_history(zval *zclient, php_http_message_t *request, php_http_ php_http_message_object_prepend(&new_hist, old_hist, 1); } - zend_update_property(php_http_client_class_entry, Z_OBJ_P(zclient), ZEND_STRL("history"), &new_hist); + zend_update_property(php_http_client_class_entry, zclient, ZEND_STRL("history"), &new_hist); zval_ptr_dtor(&new_hist); } @@ -464,7 +464,7 @@ static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, ph /* ensure the message is of type response (could be uninitialized in case of early error, like DNS) */ php_http_message_set_type(msg, PHP_HTTP_RESPONSE); - if (zend_is_true(zend_read_property(php_http_client_class_entry, Z_OBJ(zclient), ZEND_STRL("recordHistory"), 0, &rec_hist_tmp))) { + if (zend_is_true(zend_read_property(php_http_client_class_entry, &zclient, ZEND_STRL("recordHistory"), 0, &rec_hist_tmp))) { handle_history(&zclient, e->request, *response); } @@ -481,7 +481,7 @@ static ZEND_RESULT_CODE handle_response(void *arg, php_http_client_t *client, ph object_init(&info); info_ht = HASH_OF(&info); php_http_client_getopt(client, PHP_HTTP_CLIENT_OPT_TRANSFER_INFO, e->request, &info_ht); - zend_update_property(php_http_get_client_response_class_entry(), Z_OBJ(zresponse), ZEND_STRL("transferInfo"), &info); + zend_update_property(php_http_get_client_response_class_entry(), &zresponse, ZEND_STRL("transferInfo"), &info); zval_ptr_dtor(&info); zend_llist_add_element(&client->responses, &msg_obj); @@ -562,11 +562,12 @@ static void handle_debug(void *arg, php_http_client_t *client, php_http_client_e ZVAL_STRINGL(&zdata, data, size); zend_replace_error_handling(EH_NORMAL, NULL, &zeh); - zend_fcall_info_argn(&client_obj->debug.fci, 4, &zclient, &zreq, &ztype, &zdata); - ++client->callback.depth; - zend_fcall_info_call(&client_obj->debug.fci, &client_obj->debug.fcc, NULL, NULL); - --client->callback.depth; - zend_fcall_info_args_clear(&client_obj->debug.fci, 0); + if (SUCCESS == zend_fcall_info_argn(&client_obj->debug.fci, 4, &zclient, &zreq, &ztype, &zdata)) { + ++client->callback.depth; + zend_fcall_info_call(&client_obj->debug.fci, &client_obj->debug.fcc, NULL, NULL); + --client->callback.depth; + zend_fcall_info_args_clear(&client_obj->debug.fci, 0); + } zend_restore_error_handling(&zeh); zval_ptr_dtor(&zclient); @@ -606,7 +607,7 @@ static PHP_METHOD(HttpClient, __construct) } object_init_ex(&os, spl_ce_SplObjectStorage); - zend_update_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("observers"), &os); + zend_update_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), &os); zval_ptr_dtor(&os); if (persistent_handle_name) { @@ -649,13 +650,13 @@ static PHP_METHOD(HttpClient, reset) static HashTable *combined_options(HashTable *options, zval *client, zval *request) { unsigned num_options = 0; - zval z_roptions, z_options_tmp, *z_coptions = zend_read_property(php_http_client_class_entry, Z_OBJ_P(client), ZEND_STRL("options"), 0, &z_options_tmp); + zval z_roptions, z_options_tmp, *z_coptions = zend_read_property(php_http_client_class_entry, client, ZEND_STRL("options"), 0, &z_options_tmp); if (Z_TYPE_P(z_coptions) == IS_ARRAY) { num_options = zend_hash_num_elements(Z_ARRVAL_P(z_coptions)); } ZVAL_UNDEF(&z_roptions); - zend_call_method_with_0_params(Z_OBJ_P(request), NULL, NULL, "getOptions", &z_roptions); + zend_call_method_with_0_params(request, NULL, NULL, "getOptions", &z_roptions); if (Z_TYPE(z_roptions) == IS_ARRAY) { unsigned num = zend_hash_num_elements(Z_ARRVAL(z_roptions)); if (num > num_options) { @@ -835,7 +836,7 @@ static PHP_METHOD(HttpClient, requeue) RETVAL_ZVAL(getThis(), 1, 0); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_count, 0, 0, IS_LONG, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_count, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, count) { @@ -898,7 +899,7 @@ static PHP_METHOD(HttpClient, getHistory) php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return); - zhistory = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("history"), 0, &zhistory_tmp); + zhistory = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("history"), 0, &zhistory_tmp); RETVAL_ZVAL(zhistory, 1, 0); } @@ -1015,11 +1016,7 @@ static int notify(zend_object_iterator *iter, void *puser) return ZEND_HASH_APPLY_STOP; } -#if PHP_VERSION_ID >= 80100 -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_notify, 0, 0, IS_VOID, 0) -#else ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_notify, 0, 0, 0) -#endif ZEND_ARG_OBJ_INFO(0, request, http\\Client\\Request, 1) ZEND_ARG_INFO(0, progress) ZEND_END_ARG_INFO(); @@ -1032,7 +1029,7 @@ static PHP_METHOD(HttpClient, notify) php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|O!o!", &request, php_http_get_client_request_class_entry(), &zprogress), invalid_arg, return); client_obj = PHP_HTTP_OBJ(NULL, getThis()); - observers = zend_read_property(php_http_client_class_entry, &client_obj->zo, ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@ -1063,16 +1060,11 @@ static PHP_METHOD(HttpClient, notify) zval_ptr_dtor(zprogress); } } -#if PHP_VERSION_ID < 80100 + RETVAL_ZVAL(getThis(), 1, 0); -#endif } -#if PHP_VERSION_ID >= 80100 -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_attach, 0, 1, IS_VOID, 0) -#else ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_attach, 0, 0, 1) -#endif ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, attach) @@ -1083,7 +1075,7 @@ static PHP_METHOD(HttpClient, attach) php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &observer, spl_ce_SplObserver), invalid_arg, return); client_obj = PHP_HTTP_OBJ(NULL, getThis()); - observers = zend_read_property(php_http_client_class_entry, &client_obj->zo, ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@ -1095,18 +1087,13 @@ static PHP_METHOD(HttpClient, attach) } ZVAL_UNDEF(&retval); - zend_call_method_with_1_params(Z_OBJ_P(observers), NULL, NULL, "attach", &retval, observer); + zend_call_method_with_1_params(observers, NULL, NULL, "attach", &retval, observer); zval_ptr_dtor(&retval); -#if PHP_VERSION_ID < 80100 + RETVAL_ZVAL(getThis(), 1, 0); -#endif } -#if PHP_VERSION_ID >= 80100 -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpClient_detach, 0, 1, IS_VOID, 0) -#else ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_detach, 0, 0, 1) -#endif ZEND_ARG_OBJ_INFO(0, observer, SplObserver, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, detach) @@ -1115,7 +1102,7 @@ static PHP_METHOD(HttpClient, detach) php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "O", &observer, spl_ce_SplObserver), invalid_arg, return); - observers = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@ -1123,11 +1110,10 @@ static PHP_METHOD(HttpClient, detach) } ZVAL_UNDEF(&retval); - zend_call_method_with_1_params(Z_OBJ_P(observers), NULL, NULL, "detach", &retval, observer); + zend_call_method_with_1_params(observers, NULL, NULL, "detach", &retval, observer); zval_ptr_dtor(&retval); -#if PHP_VERSION_ID < 80100 + RETVAL_ZVAL(getThis(), 1, 0); -#endif } ZEND_BEGIN_ARG_INFO_EX(ai_HttpClient_getObservers, 0, 0, 0) @@ -1138,7 +1124,7 @@ static PHP_METHOD(HttpClient, getObservers) php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return); - observers = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("observers"), 0, &observers_tmp); + observers = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("observers"), 0, &observers_tmp); if (Z_TYPE_P(observers) != IS_OBJECT) { php_http_throw(unexpected_val, "Observer storage is corrupted"); @@ -1214,7 +1200,7 @@ ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClient, getOptions) { if (SUCCESS == zend_parse_parameters_none()) { - zval options_tmp, *options = zend_read_property(php_http_client_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("options"), 0, &options_tmp); + zval options_tmp, *options = zend_read_property(php_http_client_class_entry, getThis(), ZEND_STRL("options"), 0, &options_tmp); RETVAL_ZVAL(options, 1, 0); } } @@ -1403,7 +1389,7 @@ PHP_MINIT_FUNCTION(http_client) INIT_NS_CLASS_ENTRY(ce, "http", "Client", php_http_client_methods); php_http_client_class_entry = zend_register_internal_class_ex(&ce, NULL); php_http_client_class_entry->create_object = php_http_client_object_new; - zend_class_implements(php_http_client_class_entry, 2, spl_ce_SplSubject, zend_ce_countable); + zend_class_implements(php_http_client_class_entry, 2, spl_ce_SplSubject, spl_ce_Countable); memcpy(&php_http_client_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); php_http_client_object_handlers.offset = XtOffsetOf(php_http_client_object_t, zo); php_http_client_object_handlers.free_obj = php_http_client_object_free; diff --git a/src/php_http_client_request.c b/src/php_http_client_request.c index 52e9c70..9055f49 100644 --- a/src/php_http_client_request.c +++ b/src/php_http_client_request.c @@ -230,7 +230,7 @@ ZEND_END_ARG_INFO(); static PHP_METHOD(HttpClientRequest, getOptions) { if (SUCCESS == zend_parse_parameters_none()) { - zval tmp, *zoptions = zend_read_property(php_http_client_request_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("options"), 0, &tmp); + zval tmp, *zoptions = zend_read_property(php_http_client_request_class_entry, getThis(), ZEND_STRL("options"), 0, &tmp); RETURN_ZVAL(zoptions, 1, 0); } } diff --git a/src/php_http_client_response.c b/src/php_http_client_response.c index 722b4e0..34748aa 100644 --- a/src/php_http_client_response.c +++ b/src/php_http_client_response.c @@ -101,7 +101,7 @@ static PHP_METHOD(HttpClientResponse, getTransferInfo) php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &info_name, &info_len), invalid_arg, return); - info = zend_read_property(php_http_client_response_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("transferInfo"), 0, &info_tmp); + info = zend_read_property(php_http_client_response_class_entry, getThis(), ZEND_STRL("transferInfo"), 0, &info_tmp); /* request completed? */ if (Z_TYPE_P(info) != IS_OBJECT) { @@ -110,7 +110,7 @@ static PHP_METHOD(HttpClientResponse, getTransferInfo) } if (info_len && info_name) { - info = zend_read_property(NULL, Z_OBJ_P(info), php_http_pretty_key(info_name, info_len, 0, 0), info_len, 0, &info_name_tmp); + info = zend_read_property(NULL, info, php_http_pretty_key(info_name, info_len, 0, 0), info_len, 0, &info_name_tmp); if (!info) { php_http_throw(unexpected_val, "Could not find transfer info with name '%s'", info_name); diff --git a/src/php_http_cookie.c b/src/php_http_cookie.c index dd4c6c6..cd3198c 100644 --- a/src/php_http_cookie.c +++ b/src/php_http_cookie.c @@ -406,9 +406,9 @@ php_http_cookie_object_t *php_http_cookie_object_new_ex(zend_class_entry *ce, ph } \ } while(0) -zend_object *php_http_cookie_object_clone(zend_object *obj) +zend_object *php_http_cookie_object_clone(zval *obj) { - php_http_cookie_object_t *new_obj, *old_obj = PHP_HTTP_OBJ(obj, NULL); + php_http_cookie_object_t *new_obj, *old_obj = PHP_HTTP_OBJ(NULL, obj); PHP_HTTP_COOKIE_OBJECT_INIT(old_obj); @@ -981,9 +981,6 @@ static PHP_METHOD(HttpCookie, toArray) php_http_cookie_list_to_struct(obj->list, return_value); } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpCookie___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_cookie_methods[] = { PHP_ME(HttpCookie, __construct, ai_HttpCookie___construct, ZEND_ACC_PUBLIC) PHP_ME(HttpCookie, getCookies, ai_HttpCookie_getCookies, ZEND_ACC_PUBLIC) @@ -1013,7 +1010,7 @@ static zend_function_entry php_http_cookie_methods[] = { PHP_ME(HttpCookie, toArray, ai_HttpCookie_toArray, ZEND_ACC_PUBLIC) PHP_ME(HttpCookie, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpCookie, __toString, toString, ai_HttpCookie___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpCookie, __toString, toString, ai_HttpCookie_toString, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; diff --git a/src/php_http_cookie.h b/src/php_http_cookie.h index 3186d6f..e7b924e 100644 --- a/src/php_http_cookie.h +++ b/src/php_http_cookie.h @@ -62,7 +62,7 @@ typedef struct php_http_cookie_object { zend_object *php_http_cookie_object_new(zend_class_entry *ce); php_http_cookie_object_t *php_http_cookie_object_new_ex(zend_class_entry *ce, php_http_cookie_list_t *list); -zend_object *php_http_cookie_object_clone(zend_object *this_ptr); +zend_object *php_http_cookie_object_clone(zval *this_ptr); void php_http_cookie_object_free(zend_object *object); PHP_MINIT_FUNCTION(http_cookie); diff --git a/src/php_http_encoding.c b/src/php_http_encoding.c index 2e3007b..3e57e29 100644 --- a/src/php_http_encoding.c +++ b/src/php_http_encoding.c @@ -477,9 +477,9 @@ php_http_encoding_stream_object_t *php_http_encoding_stream_object_new_ex(zend_c return o; } -zend_object *php_http_encoding_stream_object_clone(zend_object *object) +zend_object *php_http_encoding_stream_object_clone(zval *object) { - php_http_encoding_stream_object_t *new_obj, *old_obj = PHP_HTTP_OBJ(object, NULL); + php_http_encoding_stream_object_t *new_obj, *old_obj = PHP_HTTP_OBJ(NULL, object); php_http_encoding_stream_t *cpy = php_http_encoding_stream_copy(old_obj->stream, NULL); if (!cpy) { diff --git a/src/php_http_encoding.h b/src/php_http_encoding.h index 842bff7..3b59829 100644 --- a/src/php_http_encoding.h +++ b/src/php_http_encoding.h @@ -76,7 +76,7 @@ PHP_HTTP_API zend_class_entry *php_http_get_encoding_stream_class_entry(void); zend_object *php_http_encoding_stream_object_new(zend_class_entry *ce); php_http_encoding_stream_object_t *php_http_encoding_stream_object_new_ex(zend_class_entry *ce, php_http_encoding_stream_t *s); -zend_object *php_http_encoding_stream_object_clone(zend_object *object); +zend_object *php_http_encoding_stream_object_clone(zval *object); void php_http_encoding_stream_object_free(zend_object *object); #endif diff --git a/src/php_http_env.c b/src/php_http_env.c index 9c88822..fdbdd92 100644 --- a/src/php_http_env.c +++ b/src/php_http_env.c @@ -417,12 +417,10 @@ ZEND_RESULT_CODE php_http_env_set_response_status_line(long code, php_http_versi { sapi_header_line h = {NULL, 0, 0}; ZEND_RESULT_CODE ret; - char *line; - h.line_len = spprintf(&line, 0, "HTTP/%u.%u %ld %s", v->major, v->minor, code, php_http_env_get_response_status_for_code(code)); - h.line = line; + h.line_len = spprintf(&h.line, 0, "HTTP/%u.%u %ld %s", v->major, v->minor, code, php_http_env_get_response_status_for_code(code)); ret = sapi_header_op(SAPI_HEADER_REPLACE, (void *) &h); - efree(line); + efree(h.line); return ret; } @@ -434,9 +432,10 @@ ZEND_RESULT_CODE php_http_env_set_response_protocol_version(php_http_version_t * ZEND_RESULT_CODE php_http_env_set_response_header(long http_code, const char *header_str, size_t header_len, zend_bool replace) { - sapi_header_line h = {header_str, header_len, http_code}; + sapi_header_line h = {estrndup(header_str, header_len), header_len, http_code}; ZEND_RESULT_CODE ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h); + efree(h.line); return ret; } @@ -444,16 +443,14 @@ ZEND_RESULT_CODE php_http_env_set_response_header_va(long http_code, zend_bool r { ZEND_RESULT_CODE ret = FAILURE; sapi_header_line h = {NULL, 0, http_code}; - char *line; - h.line_len = vspprintf(&line, 0, fmt, argv); - h.line = line; + h.line_len = vspprintf(&h.line, 0, fmt, argv); if (h.line) { if (h.line_len) { ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h); } - efree(line); + efree(h.line); } return ret; } @@ -502,19 +499,17 @@ ZEND_RESULT_CODE php_http_env_set_response_header_value(long http_code, const ch } else { sapi_header_line h; ZEND_RESULT_CODE ret; - char *line; if (name_len > INT_MAX) { return FAILURE; } h.response_code = http_code; - h.line_len = spprintf(&line, 0, "%s: %s", name_str, data->val); - h.line = line; + h.line_len = spprintf(&h.line, 0, "%s: %s", name_str, data->val); ret = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, (void *) &h); zend_string_release(data); - PTR_FREE(line); + PTR_FREE(h.line); return ret; } diff --git a/src/php_http_env_request.c b/src/php_http_env_request.c index 0ed0eb8..7c6eea8 100644 --- a/src/php_http_env_request.c +++ b/src/php_http_env_request.c @@ -140,26 +140,26 @@ static PHP_METHOD(HttpEnvRequest, __construct) zsg = php_http_env_get_superglobal(ZEND_STRL("_GET")); object_init_ex(&zqs, php_http_querystring_get_class_entry()); php_http_expect(SUCCESS == php_http_querystring_ctor(&zqs, zsg), unexpected_val, return); - zend_update_property(php_http_env_request_class_entry, &obj->zo, ZEND_STRL("query"), &zqs); + zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("query"), &zqs); zval_ptr_dtor(&zqs); zsg = php_http_env_get_superglobal(ZEND_STRL("_POST")); object_init_ex(&zqs, php_http_querystring_get_class_entry()); php_http_expect(SUCCESS == php_http_querystring_ctor(&zqs, zsg), unexpected_val, return); - zend_update_property(php_http_env_request_class_entry, &obj->zo, ZEND_STRL("form"), &zqs); + zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("form"), &zqs); zval_ptr_dtor(&zqs); zsg = php_http_env_get_superglobal(ZEND_STRL("_COOKIE")); object_init_ex(&zqs, php_http_querystring_get_class_entry()); php_http_expect(SUCCESS == php_http_querystring_ctor(&zqs, zsg), unexpected_val, return); - zend_update_property(php_http_env_request_class_entry, &obj->zo, ZEND_STRL("cookie"), &zqs); + zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("cookie"), &zqs); zval_ptr_dtor(&zqs); array_init(&zqs); if ((zsg = php_http_env_get_superglobal(ZEND_STRL("_FILES")))) { zend_hash_apply_with_arguments(Z_ARRVAL_P(zsg), grab_files, 1, &zqs); } - zend_update_property(php_http_env_request_class_entry, &obj->zo, ZEND_STRL("files"), &zqs); + zend_update_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("files"), &zqs); zval_ptr_dtor(&zqs); } @@ -169,7 +169,7 @@ static PHP_METHOD(HttpEnvRequest, __construct) zend_fcall_info_cache fcc; \ zval rv, mn, *args = ecalloc(sizeof(zval), ZEND_NUM_ARGS()); \ zval *this_ptr = getThis(); \ - zval qs_tmp, *qs = zend_read_property(Z_OBJCE_P(this_ptr), Z_OBJ_P(this_ptr), ZEND_STRL(prop), 0, &qs_tmp); \ + zval qs_tmp, *qs = zend_read_property(Z_OBJCE_P(this_ptr), this_ptr, ZEND_STRL(prop), 0, &qs_tmp); \ \ ZVAL_NULL(&rv); \ array_init(&mn); \ @@ -197,7 +197,7 @@ static PHP_METHOD(HttpEnvRequest, getForm) if (ZEND_NUM_ARGS()) { call_querystring_get("form"); } else { - zval zform_tmp, *zform = zend_read_property(php_http_env_request_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("form"), 0, &zform_tmp); + zval zform_tmp, *zform = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("form"), 0, &zform_tmp); RETURN_ZVAL(zform, 1, 0); } } @@ -213,7 +213,7 @@ static PHP_METHOD(HttpEnvRequest, getQuery) if (ZEND_NUM_ARGS()) { call_querystring_get("query"); } else { - zval zquery_tmp, *zquery = zend_read_property(php_http_env_request_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("query"), 0, &zquery_tmp); + zval zquery_tmp, *zquery = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("query"), 0, &zquery_tmp); RETURN_ZVAL(zquery, 1, 0); } } @@ -229,7 +229,7 @@ static PHP_METHOD(HttpEnvRequest, getCookie) if (ZEND_NUM_ARGS()) { call_querystring_get("cookie"); } else { - zval zcookie_tmp, *zcookie = zend_read_property(php_http_env_request_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("cookie"), 0, &zcookie_tmp); + zval zcookie_tmp, *zcookie = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("cookie"), 0, &zcookie_tmp); RETURN_ZVAL(zcookie, 1, 0); } } @@ -239,7 +239,7 @@ ZEND_END_ARG_INFO(); static PHP_METHOD(HttpEnvRequest, getFiles) { if (SUCCESS == zend_parse_parameters_none()) { - zval zfiles_tmp, *zfiles = zend_read_property(php_http_env_request_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("files"), 0, &zfiles_tmp); + zval zfiles_tmp, *zfiles = zend_read_property(php_http_env_request_class_entry, getThis(), ZEND_STRL("files"), 0, &zfiles_tmp); RETURN_ZVAL(zfiles, 1, 0); } } diff --git a/src/php_http_env_response.c b/src/php_http_env_response.c index 3dba5b9..f5d2da9 100644 --- a/src/php_http_env_response.c +++ b/src/php_http_env_response.c @@ -18,21 +18,21 @@ static void set_option(zval *options, const char *name_str, size_t name_len, int if (EXPECTED(value_ptr)) { switch (type) { case IS_DOUBLE: - zend_update_property_double(Z_OBJCE_P(options), Z_OBJ_P(options), name_str, name_len, *(double *)value_ptr); + zend_update_property_double(Z_OBJCE_P(options), options, name_str, name_len, *(double *)value_ptr); break; case IS_LONG: - zend_update_property_long(Z_OBJCE_P(options), Z_OBJ_P(options), name_str, name_len, *(zend_long *)value_ptr); + zend_update_property_long(Z_OBJCE_P(options), options, name_str, name_len, *(zend_long *)value_ptr); break; case IS_STRING: - zend_update_property_stringl(Z_OBJCE_P(options), Z_OBJ_P(options), name_str, name_len, value_ptr, value_len); + zend_update_property_stringl(Z_OBJCE_P(options), options, name_str, name_len, value_ptr, value_len); break; case IS_ARRAY: case IS_OBJECT: - zend_update_property(Z_OBJCE_P(options), Z_OBJ_P(options), name_str, name_len, value_ptr); + zend_update_property(Z_OBJCE_P(options), options, name_str, name_len, value_ptr); break; } } else { - zend_update_property_null(Z_OBJCE_P(options), Z_OBJ_P(options), name_str, name_len); + zend_update_property_null(Z_OBJCE_P(options), options, name_str, name_len); } } else { convert_to_array(options); @@ -65,7 +65,7 @@ static zval *get_option(zval *options, const char *name_str, size_t name_len, zv zval *val = NULL; if (EXPECTED(Z_TYPE_P(options) == IS_OBJECT)) { - val = zend_read_property(Z_OBJCE_P(options), Z_OBJ_P(options), name_str, name_len, 0, tmp); + val = zend_read_property(Z_OBJCE_P(options), options, name_str, name_len, 0, tmp); } else if (EXPECTED(Z_TYPE_P(options) == IS_ARRAY)) { val = zend_symtable_str_find(Z_ARRVAL_P(options), name_str, name_len); } else { @@ -363,12 +363,12 @@ static ZEND_RESULT_CODE php_http_env_response_send_head(php_http_env_response_t php_http_version_t v; zend_string *zs = zval_get_string(zoption); + zval_ptr_dtor(zoption); if (EXPECTED(zs->len && php_http_version_parse(&v, zs->val))) { ret = r->ops->set_protocol_version(r, &v); php_http_version_dtor(&v); } zend_string_release(zs); - zval_ptr_dtor(zoption); } if (ret != SUCCESS) { @@ -1205,7 +1205,7 @@ static PHP_METHOD(HttpEnvResponse, setContentDisposition) php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "a", &zdisposition), invalid_arg, return); - zend_update_property(Z_OBJCE_P(ZEND_THIS), Z_OBJ_P(ZEND_THIS), ZEND_STRL("contentDisposition"), zdisposition); + zend_update_property(Z_OBJCE_P(getThis()), getThis(), ZEND_STRL("contentDisposition"), zdisposition); RETVAL_ZVAL(getThis(), 1, 0); } diff --git a/src/php_http_etag.c b/src/php_http_etag.c index 7e309f2..048af87 100644 --- a/src/php_http_etag.c +++ b/src/php_http_etag.c @@ -12,32 +12,41 @@ #include "php_http_api.h" -#include "ext/hash/php_hash.h" +#if PHP_HTTP_HAVE_HASH +# include "ext/hash/php_hash.h" +#endif + #include "ext/standard/crc32.h" #include "ext/standard/sha1.h" #include "ext/standard/md5.h" -#if PHP_VERSION_ID >= 80100 -# define HASH_INIT_ARGS ,NULL -#else -# define HASH_INIT_ARGS -#endif - php_http_etag_t *php_http_etag_init(const char *mode) { + void *ctx; php_http_etag_t *e; - zend_string *mode_str = zend_string_init(mode, strlen(mode), 0); - const php_hash_ops *eho = php_hash_fetch_ops(mode_str); - if (!eho) { - zend_string_release(mode_str); + if (mode && (!strcasecmp(mode, "crc32b"))) { + ctx = emalloc(sizeof(uint32_t)); + *((uint32_t *) ctx) = ~0; + } else if (mode && !strcasecmp(mode, "sha1")) { + PHP_SHA1Init(ctx = emalloc(sizeof(PHP_SHA1_CTX))); + } else if (mode && !strcasecmp(mode, "md5")) { + PHP_MD5Init(ctx = emalloc(sizeof(PHP_MD5_CTX))); + } else { +#if PHP_HTTP_HAVE_HASH + const php_hash_ops *eho = NULL; + + if (mode && (eho = php_hash_fetch_ops(mode, strlen(mode)))) { + ctx = emalloc(eho->context_size); + eho->hash_init(ctx); + } else +#endif return NULL; } - zend_string_release(mode_str); - e = emalloc(sizeof(*e) + eho->context_size - 1); - e->ops = eho; - eho->hash_init(e->ctx HASH_INIT_ARGS); + e = emalloc(sizeof(*e)); + e->ctx = ctx; + e->mode = estrdup(mode); return e; } @@ -45,10 +54,32 @@ php_http_etag_t *php_http_etag_init(const char *mode) char *php_http_etag_finish(php_http_etag_t *e) { unsigned char digest[128] = {0}; - char *etag; + char *etag = NULL; + + if (!strcasecmp(e->mode, "crc32b")) { + uint32_t e_ctx; + memcpy(&e_ctx, e->ctx, 4); + e_ctx = ntohl(~e_ctx); + etag = php_http_etag_digest((unsigned char *) &e_ctx, 4); + } else if ((!strcasecmp(e->mode, "sha1"))) { + PHP_SHA1Final(digest, e->ctx); + etag = php_http_etag_digest(digest, 20); + } else if ((!strcasecmp(e->mode, "md5"))) { + PHP_MD5Final(digest, e->ctx); + etag = php_http_etag_digest(digest, 16); + } else { +#if PHP_HTTP_HAVE_HASH + const php_hash_ops *eho = NULL; - e->ops->hash_final(digest, e->ctx); - etag = php_http_etag_digest(digest, e->ops->digest_size); + if ((eho = php_hash_fetch_ops(e->mode, strlen(e->mode)))) { + eho->hash_final(digest, e->ctx); + etag = php_http_etag_digest(digest, eho->digest_size); + } +#endif + } + + efree(e->ctx); + efree(e->mode); efree(e); return etag; @@ -56,7 +87,25 @@ char *php_http_etag_finish(php_http_etag_t *e) size_t php_http_etag_update(php_http_etag_t *e, const char *data_ptr, size_t data_len) { - e->ops->hash_update(e->ctx, (const unsigned char *) data_ptr, data_len); + if (!strcasecmp(e->mode, "crc32b")) { + uint32_t i, c = *((uint32_t *) e->ctx); + for (i = 0; i < data_len; ++i) { + CRC32(c, data_ptr[i]); + } + *((uint32_t *) e->ctx) = c; + } else if ((!strcasecmp(e->mode, "sha1"))) { + PHP_SHA1Update(e->ctx, (const unsigned char *) data_ptr, data_len); + } else if ((!strcasecmp(e->mode, "md5"))) { + PHP_MD5Update(e->ctx, (const unsigned char *) data_ptr, data_len); + } else { +#if PHP_HTTP_HAVE_HASH + const php_hash_ops *eho = NULL; + + if ((eho = php_hash_fetch_ops(e->mode, strlen(e->mode)))) { + eho->hash_update(e->ctx, (const unsigned char *) data_ptr, data_len); + } +#endif + } return data_len; } @@ -70,3 +119,4 @@ size_t php_http_etag_update(php_http_etag_t *e, const char *data_ptr, size_t dat * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ + diff --git a/src/php_http_etag.h b/src/php_http_etag.h index 338506c..f208db7 100644 --- a/src/php_http_etag.h +++ b/src/php_http_etag.h @@ -13,11 +13,9 @@ #ifndef PHP_HTTP_ETAG_H #define PHP_HTTP_ETAG_H -#include "ext/hash/php_hash.h" - typedef struct php_http_etag { - const php_hash_ops *ops; - char ctx[1]; + void *ctx; + char *mode; } php_http_etag_t; PHP_HTTP_API php_http_etag_t *php_http_etag_init(const char *mode); diff --git a/src/php_http_header.c b/src/php_http_header.c index c475a81..7044c21 100644 --- a/src/php_http_header.c +++ b/src/php_http_header.c @@ -183,46 +183,11 @@ PHP_METHOD(HttpHeader, __construct) if (name_str && name_len) { char *pretty_str = estrndup(name_str, name_len); - zend_update_property_stringl(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), php_http_pretty_key(pretty_str, name_len, 1, 1), name_len); + zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("name"), php_http_pretty_key(pretty_str, name_len, 1, 1), name_len); efree(pretty_str); } if (value_str && value_len) { - zend_update_property_stringl(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), value_str, value_len); - } -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___serialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpHeader, __serialize) -{ - zval name, value, *ptr; - - zend_parse_parameters_none(); - - array_init(return_value); - ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name); - Z_TRY_ADDREF_P(ptr); - add_next_index_zval(return_value, ptr); - ptr = zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value); - Z_TRY_ADDREF_P(ptr); - add_next_index_zval(return_value, ptr); -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpHeader, __unserialize) -{ - HashTable *ha; - zval *name, *value; - - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &ha), invalid_arg, return); - name = zend_hash_index_find(ha, 0); - value = zend_hash_index_find(ha, 1); - - if (name && value) { - zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), name); - zend_update_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), value); + zend_update_property_stringl(php_http_header_class_entry, getThis(), ZEND_STRL("value"), value_str, value_len); } } @@ -236,11 +201,11 @@ PHP_METHOD(HttpHeader, serialize) zval name_tmp, value_tmp; php_http_buffer_init(&buf); - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0, &name_tmp)); php_http_buffer_appendz(&buf, zs); zend_string_release(zs); - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); if (zs->len) { php_http_buffer_appends(&buf, ": "); php_http_buffer_appendz(&buf, zs); @@ -274,16 +239,16 @@ PHP_METHOD(HttpHeader, unserialize) zend_hash_internal_pointer_reset(&ht); switch (zend_hash_get_current_key(&ht, &key, &idx)) { case HASH_KEY_IS_STRING: - zend_update_property_str(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), key); + zend_update_property_str(php_http_header_class_entry, getThis(), ZEND_STRL("name"), key); break; case HASH_KEY_IS_LONG: - zend_update_property_long(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), idx); + zend_update_property_long(php_http_header_class_entry, getThis(), ZEND_STRL("name"), idx); break; default: break; } zs = zval_get_string(zend_hash_get_current_data(&ht)); - zend_update_property_str(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), zs); + zend_update_property_str(php_http_header_class_entry, getThis(), ZEND_STRL("value"), zs); zend_string_release(zs); } } @@ -308,7 +273,7 @@ PHP_METHOD(HttpHeader, match) return; } - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); RETVAL_BOOL(php_http_match(zs->val, val_str, flags)); zend_string_release(zs); } @@ -334,7 +299,7 @@ PHP_METHOD(HttpHeader, negotiate) array_init(rs_array); } - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("name"), 0, &name_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("name"), 0, &name_tmp)); if (zend_string_equals_literal(zs, "Accept")) { sep_str = "/"; sep_len = 1; @@ -344,7 +309,7 @@ PHP_METHOD(HttpHeader, negotiate) } zend_string_release(zs); - zs = zval_get_string(zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + zs = zval_get_string(zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); if ((rs = php_http_negotiate(zs->val, zs->len, supported, sep_str, sep_len))) { PHP_HTTP_DO_NEGOTIATE_HANDLE_RESULT(rs, supported, rs_array); } else { @@ -368,7 +333,7 @@ PHP_METHOD(HttpHeader, getParams) object_init_ex(&zparams_obj, php_http_params_get_class_entry()); zargs = (zval *) ecalloc(ZEND_NUM_ARGS()+1, sizeof(zval)); - ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("value"), 0, &value_tmp)); + ZVAL_COPY_VALUE(&zargs[0], zend_read_property(php_http_header_class_entry, getThis(), ZEND_STRL("value"), 0, &value_tmp)); if (ZEND_NUM_ARGS()) { zend_get_parameters_array(ZEND_NUM_ARGS(), ZEND_NUM_ARGS(), &zargs[1]); } @@ -416,7 +381,7 @@ PHP_METHOD(HttpHeader, parse) object_init_ex(&zho, ce); Z_TRY_ADDREF_P(val); - zend_call_method_with_2_params(Z_OBJ(zho), ce, NULL, "__construct", NULL, &zkey, val); + zend_call_method_with_2_params(&zho, ce, NULL, "__construct", NULL, &zkey, val); zval_ptr_dtor(val); zval_ptr_dtor(&zkey); @@ -432,17 +397,12 @@ PHP_METHOD(HttpHeader, parse) } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpHeader___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_header_methods[] = { PHP_ME(HttpHeader, __construct, ai_HttpHeader___construct, ZEND_ACC_PUBLIC) - PHP_ME(HttpHeader, __unserialize, ai_HttpHeader___unserialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpHeader, __serialize, ai_HttpHeader___serialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC) ZEND_MALIAS(HttpHeader, toString, serialize, ai_HttpHeader_serialize, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpHeader, __toString, serialize, ai_HttpHeader___toString, ZEND_ACC_PUBLIC) + PHP_ME(HttpHeader, unserialize, ai_HttpHeader_unserialize, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, match, ai_HttpHeader_match, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, negotiate, ai_HttpHeader_negotiate, ZEND_ACC_PUBLIC) PHP_ME(HttpHeader, getParams, ai_HttpHeader_getParams, ZEND_ACC_PUBLIC) diff --git a/src/php_http_message.c b/src/php_http_message.c index cd01757..2014aac 100644 --- a/src/php_http_message.c +++ b/src/php_http_message.c @@ -509,8 +509,9 @@ zend_class_entry *php_http_message_get_class_entry(void) return php_http_message_class_entry; } -static zval *php_http_message_object_read_prop(zend_object *object, zend_string *member, int type, void **cache_slot, zval *rv); -static zval *php_http_message_object_write_prop(zend_object *object, zend_string *member, zval *value, void **cache_slot); +static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *rv); + +static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot); static zend_object_handlers php_http_message_object_handlers; static HashTable php_http_message_object_prophandlers; @@ -858,10 +859,10 @@ php_http_message_object_t *php_http_message_object_new_ex(zend_class_entry *ce, return o; } -zend_object *php_http_message_object_clone(zend_object *this_ptr) +zend_object *php_http_message_object_clone(zval *this_ptr) { php_http_message_object_t *new_obj; - php_http_message_object_t *old_obj = PHP_HTTP_OBJ(this_ptr, NULL); + php_http_message_object_t *old_obj = PHP_HTTP_OBJ(NULL, this_ptr); new_obj = php_http_message_object_new_ex(old_obj->zo.ce, php_http_message_copy(old_obj->message, NULL)); zend_objects_clone_members(&new_obj->zo, &old_obj->zo); @@ -896,48 +897,67 @@ void php_http_message_object_free(zend_object *object) zend_object_std_dtor(object); } -static zval *php_http_message_object_get_prop_ptr(zend_object *object, zend_string *member, int type, void **cache_slot) +#if PHP_VERSION_ID >= 70400 +static zval *php_http_message_object_get_prop_ptr(zval *object, zval *member, int type, void **cache_slot) { return NULL; } +#endif -static zval *php_http_message_object_read_prop(zend_object *object, zend_string *member, int type, void **cache_slot, zval *tmp) +static zval *php_http_message_object_read_prop(zval *object, zval *member, int type, void **cache_slot, zval *tmp) { zval *return_value; - php_http_message_object_prophandler_t *handler = php_http_message_object_get_prophandler(member); + zend_string *member_name = zval_get_string(member); + php_http_message_object_prophandler_t *handler = php_http_message_object_get_prophandler(member_name); return_value = zend_get_std_object_handlers()->read_property(object, member, type, cache_slot, tmp); if (handler && handler->read) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); + if (type == BP_VAR_R || type == BP_VAR_IS) { + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); + + handler->read(obj, return_value); + } else { + php_property_proxy_t *proxy; + php_property_proxy_object_t *proxy_obj; + + proxy = php_property_proxy_init(object, member_name); + proxy_obj = php_property_proxy_object_new_ex(NULL, proxy); - handler->read(obj, return_value); + ZVAL_OBJ(tmp, &proxy_obj->zo); + return_value = tmp; + } } + + zend_string_release(member_name); return return_value; } -static zval *php_http_message_object_write_prop(zend_object *object, zend_string *member, zval *value, void **cache_slot) +static PHP_WRITE_PROP_HANDLER_TYPE php_http_message_object_write_prop(zval *object, zval *member, zval *value, void **cache_slot) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); php_http_message_object_prophandler_t *handler; + zend_string *member_name = zval_get_string(member); PHP_HTTP_MESSAGE_OBJECT_INIT(obj); - if ((handler = php_http_message_object_get_prophandler(member))) { + if ((handler = php_http_message_object_get_prophandler(member_name))) { handler->write(obj, value); } else { zend_get_std_object_handlers()->write_property(object, member, value, cache_slot); } - return value; + + zend_string_release(member_name); + PHP_WRITE_PROP_HANDLER_RETURN(value); } -static HashTable *php_http_message_object_get_debug_info(zend_object *object, int *is_temp) +static HashTable *php_http_message_object_get_debug_info(zval *object, int *is_temp) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); + zval tmp; + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); HashTable *props = zend_get_std_object_handlers()->get_properties(object); char *ver_str, *url_str = NULL; size_t ver_len, url_len = 0; - zval tmp; PHP_HTTP_MESSAGE_OBJECT_INIT(obj); if (is_temp) { @@ -1012,10 +1032,10 @@ static HashTable *php_http_message_object_get_debug_info(zend_object *object, in return props; } -static HashTable *php_http_message_object_get_gc(zend_object *object, zval **table, int *n) +static HashTable *php_http_message_object_get_gc(zval *object, zval **table, int *n) { - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); - HashTable *props = object->handlers->get_properties(object); + php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, object); + HashTable *props = Z_OBJPROP_P(object); uint32_t count = 2 + zend_hash_num_elements(props); zval *val; @@ -1038,30 +1058,6 @@ static HashTable *php_http_message_object_get_gc(zend_object *object, zval **tab return NULL; } -static int php_http_message_object_cast(zend_object *object, zval *return_value, int type) -{ - php_http_message_object_t *obj = PHP_HTTP_OBJ(object, NULL); - char *string; - size_t length; - - switch (type) { - case IS_STRING: - PHP_HTTP_MESSAGE_OBJECT_INIT(obj); - php_http_message_to_string(obj->message, &string, &length); - if (string) { - RETVAL_STR(php_http_cs2zs(string, length)); - } else { - RETVAL_EMPTY_STRING(); - } - return SUCCESS; - case _IS_BOOL: - RETVAL_TRUE; - return SUCCESS; - default: - return FAILURE; - } -} - ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___construct, 0, 0, 0) ZEND_ARG_INFO(0, message) ZEND_ARG_INFO(0, greedy) @@ -1699,6 +1695,8 @@ static PHP_METHOD(HttpMessage, getParentMessage) RETVAL_OBJECT(&obj->parent->zo, 1); } +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage___toString, 0, 0, 0) +ZEND_END_ARG_INFO(); ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_toString, 0, 0, 0) ZEND_ARG_INFO(0, include_parent) ZEND_END_ARG_INFO(); @@ -1764,58 +1762,6 @@ static PHP_METHOD(HttpMessage, toCallback) } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___serialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -static PHP_METHOD(HttpMessage, __serialize) -{ - zend_ulong num_index; - zend_string *str_index; - zend_property_info *pi; - php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); - HashTable *props = php_http_message_object_get_debug_info(&obj->zo, NULL); - - zend_parse_parameters_none(); - - array_init(return_value); - - ZEND_HASH_FOREACH_KEY_PTR(&obj->zo.ce->properties_info, num_index, str_index, pi) - { - (void)num_index; - zval *val; - if (str_index && (val = zend_hash_find_ind(props, pi->name))) { - Z_TRY_ADDREF_P(val); - zend_hash_update(Z_ARRVAL_P(return_value), str_index, val); - } - } - ZEND_HASH_FOREACH_END(); -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -static PHP_METHOD(HttpMessage, __unserialize) -{ - HashTable *arr; - zend_string *key; - zval *val; - php_http_message_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); - - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr), invalid_arg, return); - - PHP_HTTP_MESSAGE_OBJECT_INIT(obj); - - ZEND_HASH_FOREACH_STR_KEY_VAL(arr, key, val) - { - php_http_message_object_prophandler_t *ph = php_http_message_object_get_prophandler(key); - if (ph) { - ph->write(obj, val); - } else { - zend_update_property_ex(php_http_message_class_entry, &obj->zo, key, val); - } - } - ZEND_HASH_FOREACH_END(); -} - ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_serialize, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, serialize) @@ -1970,7 +1916,7 @@ static PHP_METHOD(HttpMessage, splitMultipartBody) RETURN_OBJ(&php_http_message_object_new_ex(obj->zo.ce, msg)->zo); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_count, 0, 0, IS_LONG, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_count, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, count) { @@ -1985,7 +1931,7 @@ static PHP_METHOD(HttpMessage, count) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_rewind, 0, 0, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_rewind, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, rewind) { @@ -2000,7 +1946,7 @@ static PHP_METHOD(HttpMessage, rewind) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_valid, 0, 0, _IS_BOOL, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_valid, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, valid) { @@ -2011,7 +1957,7 @@ static PHP_METHOD(HttpMessage, valid) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_next, 0, 0, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_next, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, next) { @@ -2035,7 +1981,7 @@ static PHP_METHOD(HttpMessage, next) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpMessage_key, 0, 0, IS_LONG, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_key, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, key) { @@ -2046,7 +1992,7 @@ static PHP_METHOD(HttpMessage, key) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(ai_HttpMessage_current, 0, 0, http\\Message, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessage_current, 0, 0, 0) ZEND_END_ARG_INFO(); static PHP_METHOD(HttpMessage, current) { @@ -2059,9 +2005,6 @@ static PHP_METHOD(HttpMessage, current) } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessage___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_message_methods[] = { PHP_ME(HttpMessage, __construct, ai_HttpMessage___construct, ZEND_ACC_PUBLIC) PHP_ME(HttpMessage, getBody, ai_HttpMessage_getBody, ZEND_ACC_PUBLIC) @@ -2098,8 +2041,6 @@ static zend_function_entry php_http_message_methods[] = { /* implements Serializable */ PHP_ME(HttpMessage, serialize, ai_HttpMessage_serialize, ZEND_ACC_PUBLIC) PHP_ME(HttpMessage, unserialize, ai_HttpMessage_unserialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpMessage, __serialize, ai_HttpMessage___serialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpMessage, __unserialize, ai_HttpMessage___unserialize, ZEND_ACC_PUBLIC) /* implements Iterator */ PHP_ME(HttpMessage, rewind, ai_HttpMessage_rewind, ZEND_ACC_PUBLIC) @@ -2134,11 +2075,14 @@ PHP_MINIT_FUNCTION(http_message) php_http_message_object_handlers.read_property = php_http_message_object_read_prop; php_http_message_object_handlers.write_property = php_http_message_object_write_prop; php_http_message_object_handlers.get_debug_info = php_http_message_object_get_debug_info; +#if PHP_VERSION_ID >= 70400 php_http_message_object_handlers.get_property_ptr_ptr = php_http_message_object_get_prop_ptr; +#else + php_http_message_object_handlers.get_property_ptr_ptr = NULL; +#endif php_http_message_object_handlers.get_gc = php_http_message_object_get_gc; - php_http_message_object_handlers.cast_object = php_http_message_object_cast; - zend_class_implements(php_http_message_class_entry, 3, zend_ce_countable, zend_ce_serializable, zend_ce_iterator); + zend_class_implements(php_http_message_class_entry, 3, spl_ce_Countable, zend_ce_serializable, zend_ce_iterator); zend_hash_init(&php_http_message_object_prophandlers, 9, NULL, php_http_message_object_prophandler_hash_dtor, 1); zend_declare_property_long(php_http_message_class_entry, ZEND_STRL("type"), PHP_HTTP_NONE, ZEND_ACC_PROTECTED); diff --git a/src/php_http_message.h b/src/php_http_message.h index d0b604f..538cdb1 100644 --- a/src/php_http_message.h +++ b/src/php_http_message.h @@ -104,7 +104,7 @@ ZEND_RESULT_CODE php_http_message_object_init_body_object(php_http_message_objec zend_object *php_http_message_object_new(zend_class_entry *ce); php_http_message_object_t *php_http_message_object_new_ex(zend_class_entry *ce, php_http_message_t *msg); -zend_object *php_http_message_object_clone(zend_object *object); +zend_object *php_http_message_object_clone(zval *object); void php_http_message_object_free(zend_object *object); #endif diff --git a/src/php_http_message_body.c b/src/php_http_message_body.c index 8bde1a7..97b1a14 100644 --- a/src/php_http_message_body.c +++ b/src/php_http_message_body.c @@ -420,7 +420,7 @@ static ZEND_RESULT_CODE add_recursive_files(php_http_message_body_t *body, const } else { zend_string *tmp = zval_get_string(zdata); - stream = php_http_mem_stream_open(TEMP_STREAM_READONLY, tmp); + stream = php_stream_memory_open(TEMP_STREAM_READONLY, tmp->val, tmp->len); zend_string_release(tmp); } } else { @@ -432,7 +432,7 @@ static ZEND_RESULT_CODE add_recursive_files(php_http_message_body_t *body, const return FAILURE; } else { zend_string *znc = zval_get_string(zname), *ztc = zval_get_string(ztype); - php_http_arrkey_t arrkey = {0, znc, 0, 0}; + php_http_arrkey_t arrkey = {0, znc}; char *key = format_key(&arrkey, name); ZEND_RESULT_CODE ret = php_http_message_body_add_form_file(body, key, ztc->val, zfc->val, stream); @@ -590,10 +590,10 @@ php_http_message_body_object_t *php_http_message_body_object_new_ex(zend_class_e return o; } -zend_object *php_http_message_body_object_clone(zend_object *object) +zend_object *php_http_message_body_object_clone(zval *object) { php_http_message_body_object_t *new_obj; - php_http_message_body_object_t *old_obj = PHP_HTTP_OBJ(object, NULL); + php_http_message_body_object_t *old_obj = PHP_HTTP_OBJ(NULL, object); php_http_message_body_t *body = php_http_message_body_copy(old_obj->body, NULL); new_obj = php_http_message_body_object_new_ex(old_obj->zo.ce, body); @@ -602,10 +602,10 @@ zend_object *php_http_message_body_object_clone(zend_object *object) return &new_obj->zo; } -static HashTable *php_http_message_body_object_get_gc(zend_object *object, zval **table, int *n) +static HashTable *php_http_message_body_object_get_gc(zval *object, zval **table, int *n) { - php_http_message_body_object_t *obj = PHP_HTTP_OBJ(object, NULL); - HashTable *props = object->handlers->get_properties(object); + php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, object); + HashTable *props = Z_OBJPROP_P(object); uint32_t count = zend_hash_num_elements(props); obj->gc = erealloc(obj->gc, (1 + count) * sizeof(zval)); @@ -670,9 +670,9 @@ PHP_METHOD(HttpMessageBody, __construct) } } -ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_serialize, 0, 0, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody___toString, 0, 0, 0) ZEND_END_ARG_INFO(); -PHP_METHOD(HttpMessageBody, serialize) +PHP_METHOD(HttpMessageBody, __toString) { if (SUCCESS == zend_parse_parameters_none()) { php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); @@ -693,60 +693,18 @@ ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_unserialize, 0, 0, 1) ZEND_END_ARG_INFO(); PHP_METHOD(HttpMessageBody, unserialize) { - zend_string *us_str; + char *us_str; + size_t us_len; - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "S", &us_str)) { + if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "s", &us_str, &us_len)) { php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); - php_stream *s = php_http_mem_stream_open(0, us_str); + php_stream *s = php_stream_memory_open(0, us_str, us_len); obj->body = php_http_message_body_init(NULL, s); php_stream_to_zval(s, obj->gc); } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpMessageBody, __unserialize) -{ - HashTable *arr; - - if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "h", &arr)) { - zval *zv = zend_hash_index_find(arr, 0); - - if (zv) { - zend_string *zs = zval_get_string(zv); - php_stream *s = php_http_mem_stream_open(0, zs); - php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); - - obj->body = php_http_message_body_init(NULL, s); - php_stream_to_zval(s, obj->gc); - zend_string_release(zs); - } - } -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___serialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpMessageBody, __serialize) -{ - - php_http_message_body_object_t *obj = PHP_HTTP_OBJ(NULL, getThis()); - zend_string *zs; - - zend_parse_parameters_none(); - - PHP_HTTP_MESSAGE_BODY_OBJECT_INIT(obj); - - array_init(return_value); - zs = php_http_message_body_to_string(obj->body, 0, 0); - if (zs) { - add_index_str(return_value, 0, zs); - } -} - - - ZEND_BEGIN_ARG_INFO_EX(ai_HttpMessageBody_toStream, 0, 0, 1) ZEND_ARG_INFO(0, stream) ZEND_ARG_INFO(0, offset) @@ -951,17 +909,12 @@ PHP_METHOD(HttpMessageBody, stat) } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpMessageBody___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_message_body_methods[] = { PHP_ME(HttpMessageBody, __construct, ai_HttpMessageBody___construct, ZEND_ACC_PUBLIC) - PHP_ME(HttpMessageBody, serialize, ai_HttpMessageBody_serialize, ZEND_ACC_PUBLIC) - PHP_MALIAS(HttpMessageBody, toString, serialize, ai_HttpMessageBody_serialize, ZEND_ACC_PUBLIC) - PHP_MALIAS(HttpMessageBody, __toString, serialize, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC) + PHP_ME(HttpMessageBody, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC) + PHP_MALIAS(HttpMessageBody, toString, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC) + PHP_MALIAS(HttpMessageBody, serialize, __toString, ai_HttpMessageBody___toString, ZEND_ACC_PUBLIC) PHP_ME(HttpMessageBody, unserialize, ai_HttpMessageBody_unserialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpMessageBody, __serialize, ai_HttpMessageBody___serialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpMessageBody, __unserialize,ai_HttpMessageBody___unserialize,ZEND_ACC_PUBLIC) PHP_ME(HttpMessageBody, toStream, ai_HttpMessageBody_toStream, ZEND_ACC_PUBLIC) PHP_ME(HttpMessageBody, toCallback, ai_HttpMessageBody_toCallback, ZEND_ACC_PUBLIC) PHP_ME(HttpMessageBody, getResource, ai_HttpMessageBody_getResource, ZEND_ACC_PUBLIC) diff --git a/src/php_http_message_body.h b/src/php_http_message_body.h index 81566f2..d4115f5 100644 --- a/src/php_http_message_body.h +++ b/src/php_http_message_body.h @@ -71,7 +71,7 @@ PHP_MINIT_FUNCTION(http_message_body); zend_object *php_http_message_body_object_new(zend_class_entry *ce); php_http_message_body_object_t *php_http_message_body_object_new_ex(zend_class_entry *ce, php_http_message_body_t *body); -zend_object *php_http_message_body_object_clone(zend_object *object); +zend_object *php_http_message_body_object_clone(zval *object); void php_http_message_body_object_free(zend_object *object); #endif diff --git a/src/php_http_misc.c b/src/php_http_misc.c index 261387f..f0cc25f 100644 --- a/src/php_http_misc.c +++ b/src/php_http_misc.c @@ -261,9 +261,10 @@ size_t php_http_pass_fcall_callback(void *cb_arg, const char *str, size_t len) zval zdata; ZVAL_STRINGL(&zdata, str, len); - zend_fcall_info_argn(&fcd->fci, 2, &fcd->fcz, &zdata); - zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL); - zend_fcall_info_args_clear(&fcd->fci, 0); + if (SUCCESS == zend_fcall_info_argn(&fcd->fci, 2, &fcd->fcz, &zdata)) { + zend_fcall_info_call(&fcd->fci, &fcd->fcc, NULL, NULL); + zend_fcall_info_args_clear(&fcd->fci, 0); + } zval_ptr_dtor(&zdata); return len; } diff --git a/src/php_http_misc.h b/src/php_http_misc.h index c45ab15..b91638e 100644 --- a/src/php_http_misc.h +++ b/src/php_http_misc.h @@ -99,55 +99,47 @@ static inline const char *php_http_locate_bin_eol(const char *bin, size_t len, i #if PHP_DEBUG # undef HASH_OF -# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL)))) +# if PHP_VERSION_ID >= 70500 +# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties(Z_OBJ_P(p)) : NULL)))) +# else +# define HASH_OF(p) ((HashTable*)(Z_TYPE_P(p)==IS_ARRAY ? Z_ARRVAL_P(p) : ((Z_TYPE_P(p)==IS_OBJECT ? Z_OBJ_HT_P(p)->get_properties((p)) : NULL)))) +# endif #endif -#if PHP_VERSION_ID >= 80100 -# define php_http_mem_stream_open(type, zstr) php_stream_memory_open((type), (zstr)) -#else -# define php_http_mem_stream_open(type, zstr) php_stream_memory_open((type), (zstr)->val, (zstr)->len) -# define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) -# define ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_OBJ_INFO_EX(name, return_reference, required_num_args, type, allow_null) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, return_reference, required_num_args) +#ifndef GC_SET_REFCOUNT +# define GC_SET_REFCOUNT(gc, rc) GC_REFCOUNT(gc) = rc +#endif +#ifndef GC_ADDREF +# define GC_ADDREF(gc) ++GC_REFCOUNT(gc) +#endif +#ifndef GC_DELREF +# define GC_DELREF(gc) --GC_REFCOUNT(gc) #endif -#define HT_IS_RECURSIVE(ht) GC_IS_RECURSIVE(ht) -#define HT_PROTECT_RECURSION(ht) GC_PROTECT_RECURSION(ht) -#define HT_UNPROTECT_RECURSION(ht) GC_UNPROTECT_RECURSION(ht) - -#ifndef convert_to_explicit_type -# define convert_to_explicit_type(pzv, type) \ - do { \ - switch (type) { \ - case IS_NULL: \ - convert_to_null(pzv); \ - break; \ - case IS_LONG: \ - convert_to_long(pzv); \ - break; \ - case IS_DOUBLE: \ - convert_to_double(pzv); \ - break; \ - case _IS_BOOL: \ - convert_to_boolean(pzv); \ - break; \ - case IS_ARRAY: \ - convert_to_array(pzv); \ - break; \ - case IS_OBJECT: \ - convert_to_object(pzv); \ - break; \ - case IS_STRING: \ - convert_to_string(pzv); \ - break; \ - default: \ - assert(0); \ - break; \ - } \ - } while (0); +#ifdef ZEND_HASH_GET_APPLY_COUNT +# define HT_IS_RECURSIVE(ht) (ZEND_HASH_GET_APPLY_COUNT(ht) > 0) +#else +# define HT_IS_RECURSIVE(ht) GC_IS_RECURSIVE(ht) +#endif +#ifdef ZEND_HASH_INC_APPLY_COUNT +# define HT_PROTECT_RECURSION(ht) ZEND_HASH_INC_APPLY_COUNT(ht) +#else +# define HT_PROTECT_RECURSION(ht) GC_PROTECT_RECURSION(ht) +#endif +#ifdef ZEND_HASH_DEC_APPLY_COUNT +# define HT_UNPROTECT_RECURSION(ht) ZEND_HASH_DEC_APPLY_COUNT(ht) +#else +# define HT_UNPROTECT_RECURSION(ht) GC_UNPROTECT_RECURSION(ht) +#endif +#if PHP_VERSION_ID >= 70400 +# define PHP_WRITE_PROP_HANDLER_TYPE zval * +# define PHP_WRITE_PROP_HANDLER_RETURN(v) return v +#else +# define PHP_WRITE_PROP_HANDLER_TYPE void +# define PHP_WRITE_PROP_HANDLER_RETURN(v) #endif + static inline void *PHP_HTTP_OBJ(zend_object *zo, zval *zv) { if (!zo) { @@ -158,8 +150,16 @@ static inline void *PHP_HTTP_OBJ(zend_object *zo, zval *zv) static inline zend_string *php_http_cs2zs(char *s, size_t l) { - zend_string *str = zend_string_init(s, l, 0); - efree(s); + zend_string *str = erealloc(s, sizeof(*str) + l); + + memmove(str->val, str, l); + str->val[l] = 0; + str->len = l; + str->h = 0; + + GC_SET_REFCOUNT(str, 1); + GC_TYPE_INFO(str) = IS_STRING; + return str; } @@ -180,6 +180,9 @@ static inline ZEND_RESULT_CODE php_http_ini_entry(const char *name_str, size_t n return FAILURE; } +#define Z_ISUSER(zv) (Z_TYPE(zv) <= 10) +#define Z_ISUSER_P(zvp) Z_ISUSER(*(zvp)) + /* return object(values) */ #define ZVAL_OBJECT(z, o, addref) \ ZVAL_OBJ(z, o); \ diff --git a/src/php_http_negotiate.c b/src/php_http_negotiate.c index 3a5548e..cd09d37 100644 --- a/src/php_http_negotiate.c +++ b/src/php_http_negotiate.c @@ -16,8 +16,9 @@ # define PHP_HTTP_DEBUG_NEG 0 #endif -static int php_http_negotiate_sort(Bucket *b1, Bucket *b2) +static int php_http_negotiate_sort(const void *first, const void *second) { + Bucket *b1 = (Bucket *) first, *b2 = (Bucket *) second; int result = numeric_compare_function(&b1->val, &b2->val); return (result > 0 ? -1 : (result < 0 ? 1 : 0)); diff --git a/src/php_http_options.c b/src/php_http_options.c index 94d703e..65a27af 100644 --- a/src/php_http_options.c +++ b/src/php_http_options.c @@ -16,7 +16,7 @@ static void php_http_options_hash_dtor(zval *pData) { php_http_option_t *opt = Z_PTR_P(pData); - zval_internal_ptr_dtor(&opt->defval); + zval_internal_dtor(&opt->defval); zend_hash_destroy(&opt->suboptions.options); zend_string_release(opt->name); pefree(opt, opt->persistent); diff --git a/src/php_http_params.c b/src/php_http_params.c index f40b89f..75a9e38 100644 --- a/src/php_http_params.c +++ b/src/php_http_params.c @@ -20,7 +20,7 @@ static php_http_params_opts_t def_opts = { def_param_sep_ptr, def_arg_sep_ptr, def_val_sep_ptr, - {{0}, {0}, {0}}, + {{0}}, PHP_HTTP_PARAMS_DEFAULT }; @@ -1069,16 +1069,16 @@ PHP_METHOD(HttpParams, __construct) { switch (ZEND_NUM_ARGS()) { case 5: - zend_update_property_long(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("flags"), flags); + zend_update_property_long(php_http_params_class_entry, getThis(), ZEND_STRL("flags"), flags); /* no break */ case 4: - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("val_sep"), val_sep); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), val_sep); /* no break */ case 3: - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("arg_sep"), arg_sep); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), arg_sep); /* no break */ case 2: - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("param_sep"), param_sep); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), param_sep); /* no break */ } @@ -1087,7 +1087,7 @@ PHP_METHOD(HttpParams, __construct) case IS_OBJECT: case IS_ARRAY: convert_to_array(zparams); - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), zparams); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), zparams); break; default: zs = zval_get_string(zparams); @@ -1096,15 +1096,15 @@ PHP_METHOD(HttpParams, __construct) php_http_params_opts_t opts = { {zs->val, zs->len}, - php_http_params_separator_init(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("param_sep"), 0, &tmp)), - php_http_params_separator_init(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("arg_sep"), 0, &tmp)), - php_http_params_separator_init(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("val_sep"), 0, &tmp)), - {{0}, {0}, {0}}, flags + php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0, &tmp)), + php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0, &tmp)), + php_http_params_separator_init(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0, &tmp)), + {{0}}, flags }; array_init(&tmp); php_http_params_parse(Z_ARRVAL(tmp), &opts); - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), &tmp); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), &tmp); zval_ptr_dtor(&tmp); php_http_params_separator_free(opts.param); @@ -1118,7 +1118,7 @@ PHP_METHOD(HttpParams, __construct) zval tmp; array_init(&tmp); - zend_update_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), &tmp); + zend_update_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), &tmp); zval_ptr_dtor(&tmp); } } @@ -1134,7 +1134,7 @@ PHP_METHOD(HttpParams, toArray) if (SUCCESS != zend_parse_parameters_none()) { return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); RETURN_ZVAL(zparams, 1, 0); } @@ -1148,23 +1148,23 @@ PHP_METHOD(HttpParams, toString) long flags; php_http_buffer_t buf; - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); convert_to_array_ex(zparams); - flags = zval_get_long(zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("flags"), 0, &flags_tmp)); + flags = zval_get_long(zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("flags"), 0, &flags_tmp)); - zpsep = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("param_sep"), 0, &psep_tmp); + zpsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("param_sep"), 0, &psep_tmp); if (Z_TYPE_P(zpsep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zpsep)))) { psep = zval_get_string(tmp); } else { psep = zval_get_string(zpsep); } - zasep = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("arg_sep"), 0, &asep_tmp); + zasep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("arg_sep"), 0, &asep_tmp); if (Z_TYPE_P(zasep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zasep)))) { asep = zval_get_string(tmp); } else { asep = zval_get_string(zasep); } - zvsep = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("val_sep"), 0, &vsep_tmp); + zvsep = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("val_sep"), 0, &vsep_tmp); if (Z_TYPE_P(zvsep) == IS_ARRAY && (tmp = zend_hash_get_current_data(Z_ARRVAL_P(zvsep)))) { vsep = zval_get_string(tmp); } else { @@ -1181,7 +1181,7 @@ PHP_METHOD(HttpParams, toString) RETVAL_STR(php_http_cs2zs(buf.data, buf.used)); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetExists, 0, 1, _IS_BOOL, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetExists, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO(); PHP_METHOD(HttpParams, offsetExists) @@ -1193,7 +1193,7 @@ PHP_METHOD(HttpParams, offsetExists) return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); if (Z_TYPE_P(zparams) == IS_ARRAY && (zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) { RETVAL_BOOL(Z_TYPE_P(zparam) != IS_NULL); @@ -1202,7 +1202,7 @@ PHP_METHOD(HttpParams, offsetExists) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetGet, 0, 1, IS_MIXED, 1) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetGet, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO(); PHP_METHOD(HttpParams, offsetGet) @@ -1214,14 +1214,14 @@ PHP_METHOD(HttpParams, offsetGet) return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); if (Z_TYPE_P(zparams) == IS_ARRAY && (zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) { RETVAL_ZVAL(zparam, 1, 0); } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetUnset, 0, 1, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetUnset, 0, 0, 1) ZEND_ARG_INFO(0, name) ZEND_END_ARG_INFO(); PHP_METHOD(HttpParams, offsetUnset) @@ -1233,14 +1233,14 @@ PHP_METHOD(HttpParams, offsetUnset) return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); if (Z_TYPE_P(zparams) == IS_ARRAY) { zend_symtable_del(Z_ARRVAL_P(zparams), name); } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpParams_offsetSet, 0, 2, IS_VOID, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpParams_offsetSet, 0, 0, 2) ZEND_ARG_INFO(0, name) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO(); @@ -1249,14 +1249,14 @@ PHP_METHOD(HttpParams, offsetSet) zend_string *name; zval zparams_tmp, *zparam, *zparams, *nvalue; - if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S!z", &name, &nvalue)) { + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "Sz", &name, &nvalue)) { return; } - zparams = zend_read_property(php_http_params_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("params"), 0, &zparams_tmp); + zparams = zend_read_property(php_http_params_class_entry, getThis(), ZEND_STRL("params"), 0, &zparams_tmp); convert_to_array(zparams); - if (name && name->len) { + if (name->len) { if (Z_TYPE_P(nvalue) == IS_ARRAY) { if ((zparam = zend_symtable_find(Z_ARRVAL_P(zparams), name))) { convert_to_array(zparam); @@ -1290,15 +1290,12 @@ PHP_METHOD(HttpParams, offsetSet) } } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpParams___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_params_methods[] = { PHP_ME(HttpParams, __construct, ai_HttpParams___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_ME(HttpParams, toArray, ai_HttpParams_toArray, ZEND_ACC_PUBLIC) PHP_ME(HttpParams, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpParams, __toString, toString, ai_HttpParams___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpParams, __toString, toString, ai_HttpParams_toString, ZEND_ACC_PUBLIC) PHP_ME(HttpParams, offsetExists, ai_HttpParams_offsetExists, ZEND_ACC_PUBLIC) PHP_ME(HttpParams, offsetUnset, ai_HttpParams_offsetUnset, ZEND_ACC_PUBLIC) @@ -1348,3 +1345,4 @@ PHP_MINIT_FUNCTION(http_params) * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */ + diff --git a/src/php_http_querystring.c b/src/php_http_querystring.c index 06d52c5..b1c6a66 100644 --- a/src/php_http_querystring.c +++ b/src/php_http_querystring.c @@ -38,7 +38,7 @@ static inline void php_http_querystring_set(zval *instance, zval *params, int fl array_init(&qa); if (flags & QS_MERGE) { - zval old_tmp, *old = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), 0, &old_tmp); + zval old_tmp, *old = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &old_tmp); ZVAL_DEREF(old); if (Z_TYPE_P(old) == IS_ARRAY) { @@ -47,13 +47,13 @@ static inline void php_http_querystring_set(zval *instance, zval *params, int fl } php_http_querystring_update(&qa, params, NULL); - zend_update_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), &qa); + zend_update_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), &qa); zval_ptr_dtor(&qa); } static inline void php_http_querystring_str(zval *instance, zval *return_value) { - zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), 0, &qa_tmp); + zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); if (Z_TYPE_P(qa) == IS_ARRAY) { @@ -65,7 +65,7 @@ static inline void php_http_querystring_str(zval *instance, zval *return_value) static inline void php_http_querystring_get(zval *instance, int type, char *name, uint32_t name_len, zval *defval, zend_bool del, zval *return_value) { - zval *arrval, qarray_tmp, *qarray = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(instance), ZEND_STRL("queryArray"), 0, &qarray_tmp); + zval *arrval, qarray_tmp, *qarray = zend_read_property(php_http_querystring_class_entry, instance, ZEND_STRL("queryArray"), 0, &qarray_tmp); ZVAL_DEREF(qarray); if ((Z_TYPE_P(qarray) == IS_ARRAY) && (arrval = zend_symtable_str_find(Z_ARRVAL_P(qarray), name, name_len))) { @@ -254,7 +254,7 @@ ZEND_RESULT_CODE php_http_querystring_update(zval *qarray, zval *params, zval *o /* squeeze the hash out of the zval */ if (Z_TYPE_P(params) == IS_OBJECT && instanceof_function(Z_OBJCE_P(params), php_http_querystring_class_entry)) { - zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(params), ZEND_STRL("queryArray"), 0, &qa_tmp); + zval qa_tmp, *qa = zend_read_property(php_http_querystring_class_entry, params, ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); convert_to_array(qa); @@ -378,12 +378,13 @@ PHP_METHOD(HttpQueryString, getGlobalInstance) if (Z_TYPE_P(instance) == IS_OBJECT) { RETVAL_ZVAL(instance, 1, 0); } else if ((_GET = php_http_env_get_superglobal(ZEND_STRL("_GET")))) { - zval *qa; - zend_string *qa_str = zend_string_init(ZEND_STRL("queryArray"), 0); + zval tmp, *qa; ZVAL_OBJ(return_value, php_http_querystring_object_new(php_http_querystring_class_entry)); - qa = Z_OBJ_HT_P(return_value)->get_property_ptr_ptr(Z_OBJ_P(return_value), qa_str, BP_VAR_RW, NULL); - zend_string_release(qa_str); + + ZVAL_STRING(&tmp, "queryArray"); + qa = Z_OBJ_HT_P(return_value)->get_property_ptr_ptr(return_value, &tmp, BP_VAR_RW, NULL); + zval_ptr_dtor(&tmp); ZVAL_NEW_REF(_GET, _GET); ZVAL_COPY(qa, _GET); @@ -395,7 +396,7 @@ PHP_METHOD(HttpQueryString, getGlobalInstance) } -ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, Traversable, 0) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_getIterator, 0, 0, 0) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, getIterator) { @@ -403,10 +404,10 @@ PHP_METHOD(HttpQueryString, getIterator) php_http_expect(SUCCESS == zend_parse_parameters_none(), invalid_arg, return); - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); object_init_ex(return_value, spl_ce_RecursiveArrayIterator); - zend_call_method_with_1_params(Z_OBJ_P(return_value), spl_ce_RecursiveArrayIterator, NULL, "__construct", NULL, qa); + zend_call_method_with_1_params(return_value, spl_ce_RecursiveArrayIterator, NULL, "__construct", NULL, qa); } ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_toString, 0, 0, 0) @@ -429,7 +430,7 @@ PHP_METHOD(HttpQueryString, toArray) return; } - zqa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &zqa_tmp); + zqa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &zqa_tmp); RETURN_ZVAL(zqa, 1, 0); } @@ -506,9 +507,9 @@ PHP_METHOD(HttpQueryString, mod) php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "z", ¶ms), invalid_arg, return); zend_replace_error_handling(EH_THROW, php_http_get_exception_bad_querystring_class_entry(), &zeh); - ZVAL_OBJ(return_value, Z_OBJ_HT_P(instance)->clone_obj(Z_OBJ_P(instance))); + ZVAL_OBJ(return_value, Z_OBJ_HT_P(instance)->clone_obj(instance)); /* make sure we do not inherit the reference to _GET */ - SEPARATE_ZVAL(zend_read_property(Z_OBJCE_P(return_value), Z_OBJ_P(return_value), ZEND_STRL("queryArray"), 0, &qa_tmp)); + SEPARATE_ZVAL(zend_read_property(Z_OBJCE_P(return_value), return_value, ZEND_STRL("queryArray"), 0, &qa_tmp)); php_http_querystring_set(return_value, params, QS_MERGE); zend_restore_error_handling(&zeh); } @@ -550,7 +551,7 @@ PHP_METHOD(HttpQueryString, xlate) php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &ie, &ie_len, &oe, &oe_len), invalid_arg, return); array_init(&na); - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); convert_to_array(qa); @@ -566,29 +567,6 @@ PHP_METHOD(HttpQueryString, xlate) } #endif /* HAVE_ICONV */ -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___serialize, 0, 0, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpQueryString, __serialize) -{ - zval *zqa, zqa_tmp; - - zend_parse_parameters_none(); - - zqa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &zqa_tmp); - RETURN_ZVAL(zqa, 1, 0); -} - -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___unserialize, 0, 1, IS_VOID, 0) - ZEND_ARG_TYPE_INFO(0, data, IS_ARRAY, 0) -ZEND_END_ARG_INFO(); -PHP_METHOD(HttpQueryString, __unserialize) -{ - zval *qa; - - php_http_expect(SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS(), "a", &qa), invalid_arg, return); - php_http_querystring_set(getThis(), qa, 0); -} - ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_serialize, 0, 0, 0) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, serialize) @@ -605,7 +583,7 @@ ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, unserialize) { zval *serialized; - + if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "z", &serialized)) { return; } @@ -617,8 +595,8 @@ PHP_METHOD(HttpQueryString, unserialize) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetGet, 0, 1, IS_MIXED, 1) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetGet, 0, 0, 1) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetGet) { @@ -628,8 +606,8 @@ PHP_METHOD(HttpQueryString, offsetGet) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) { return; } + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); if (Z_TYPE_P(qa) == IS_ARRAY) { @@ -639,8 +617,8 @@ PHP_METHOD(HttpQueryString, offsetGet) } } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetSet, 0, 2, IS_VOID, 0) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetSet, 0, 0, 2) + ZEND_ARG_INFO(0, offset) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetSet) @@ -664,8 +642,8 @@ PHP_METHOD(HttpQueryString, offsetSet) zval_ptr_dtor(¶m); } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetExists, 0, 1, _IS_BOOL, 0) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetExists, 0, 0, 1) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetExists) { @@ -675,8 +653,8 @@ PHP_METHOD(HttpQueryString, offsetExists) if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "S", &offset)) { return; } + qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0, &qa_tmp); - qa = zend_read_property(php_http_querystring_class_entry, Z_OBJ_P(ZEND_THIS), ZEND_STRL("queryArray"), 0, &qa_tmp); ZVAL_DEREF(qa); if (Z_TYPE_P(qa) == IS_ARRAY) { @@ -687,8 +665,8 @@ PHP_METHOD(HttpQueryString, offsetExists) RETURN_FALSE; } -ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 1, IS_VOID, 0) - ZEND_ARG_INFO(0, name) +ZEND_BEGIN_ARG_INFO_EX(ai_HttpQueryString_offsetUnset, 0, 0, 1) + ZEND_ARG_INFO(0, offset) ZEND_END_ARG_INFO(); PHP_METHOD(HttpQueryString, offsetUnset) { @@ -706,15 +684,12 @@ PHP_METHOD(HttpQueryString, offsetUnset) zval_ptr_dtor(¶m); } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpQueryString___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_querystring_methods[] = { PHP_ME(HttpQueryString, __construct, ai_HttpQueryString___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) PHP_ME(HttpQueryString, toArray, ai_HttpQueryString_toArray, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpQueryString, __toString, toString, ai_HttpQueryString___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpQueryString, __toString, toString, ai_HttpQueryString_toString, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, get, ai_HttpQueryString_get, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, set, ai_HttpQueryString_set, ZEND_ACC_PUBLIC) @@ -737,8 +712,6 @@ static zend_function_entry php_http_querystring_methods[] = { /* Implements Serializable */ PHP_ME(HttpQueryString, serialize, ai_HttpQueryString_serialize, ZEND_ACC_PUBLIC) PHP_ME(HttpQueryString, unserialize, ai_HttpQueryString_unserialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpQueryString, __serialize, ai_HttpQueryString___serialize, ZEND_ACC_PUBLIC) - PHP_ME(HttpQueryString, __unserialize, ai_HttpQueryString___unserialize, ZEND_ACC_PUBLIC) /* Implements ArrayAccess */ PHP_ME(HttpQueryString, offsetGet, ai_HttpQueryString_offsetGet, ZEND_ACC_PUBLIC) diff --git a/src/php_http_url.c b/src/php_http_url.c index 943a436..32bae58 100644 --- a/src/php_http_url.c +++ b/src/php_http_url.c @@ -535,7 +535,7 @@ HashTable *php_http_url_to_struct(const php_http_url_t *url, zval *strct) if (!strct || Z_TYPE_P(strct) == IS_ARRAY) { \ zend_hash_str_update(ht, part, lenof(part), &tmp); \ } else { \ - zend_update_property(Z_OBJCE_P(strct), Z_OBJ_P(strct), part, lenof(part), &tmp); \ + zend_update_property(Z_OBJCE_P(strct), strct, part, lenof(part), &tmp); \ zval_ptr_dtor(&tmp); \ } @@ -1984,7 +1984,7 @@ PHP_METHOD(HttpUrl, mod) if ((old_purl = php_http_url_from_struct(HASH_OF(getThis())))) { php_http_url_t *res_purl; - ZVAL_OBJ(return_value, zend_objects_clone_obj(Z_OBJ_P(getThis()))); + ZVAL_OBJ(return_value, zend_objects_clone_obj(getThis())); res_purl = php_http_url_mod(old_purl, new_purl, flags); php_http_url_to_struct(res_purl, return_value); @@ -2034,14 +2034,11 @@ PHP_METHOD(HttpUrl, toArray) php_http_url_free(&purl); } -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(ai_HttpUrl___toString, 0, 0, IS_STRING, 0) -ZEND_END_ARG_INFO(); - static zend_function_entry php_http_url_methods[] = { PHP_ME(HttpUrl, __construct, ai_HttpUrl___construct, ZEND_ACC_PUBLIC) PHP_ME(HttpUrl, mod, ai_HttpUrl_mod, ZEND_ACC_PUBLIC) PHP_ME(HttpUrl, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC) - ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl___toString, ZEND_ACC_PUBLIC) + ZEND_MALIAS(HttpUrl, __toString, toString, ai_HttpUrl_toString, ZEND_ACC_PUBLIC) PHP_ME(HttpUrl, toArray, ai_HttpUrl_toArray, ZEND_ACC_PUBLIC) EMPTY_FUNCTION_ENTRY }; diff --git a/tests/client002.phpt b/tests/client002.phpt index d020f16..5b0b2aa 100644 --- a/tests/client002.phpt +++ b/tests/client002.phpt @@ -14,7 +14,6 @@ echo "Test\n"; class Observer implements SplObserver { - #[ReturnTypeWillChange] function update(SplSubject $client, http\Client\Request $request = null, StdClass $progress = null) { echo "P"; /* fence against buggy infof() calls in some curl versions */ diff --git a/tests/client012.phpt b/tests/client012.phpt index 5dd1513..0e72628 100644 --- a/tests/client012.phpt +++ b/tests/client012.phpt @@ -26,8 +26,6 @@ var_dump( $client->attach($observer = new class implements SplObserver { public $data = []; - - #[ReturnTypeWillChange] function update(SplSubject $client, $req = null, $progress = null) { $ti = $client->getTransferInfo($req); if (isset($ti->tls_session["internals"])) { diff --git a/tests/client013.phpt b/tests/client013.phpt index 962d448..477edf7 100644 --- a/tests/client013.phpt +++ b/tests/client013.phpt @@ -16,13 +16,11 @@ class Client extends http\Client { public $pi; } class ProgressObserver1 implements SplObserver { - #[ReturnTypeWillChange] function update(SplSubject $c, $r = null) { if ($c->getProgressInfo($r)) $c->pi .= "-"; } } class ProgressObserver2 implements SplObserver { - #[ReturnTypeWillChange] function update(SplSubject $c, $r = null) { if ($c->getProgressInfo($r)) $c->pi .= "."; } @@ -32,7 +30,6 @@ class CallbackObserver implements SplObserver { function __construct($callback) { $this->callback = $callback; } - #[ReturnTypeWillChange] function update(SplSubject $c, $r = null) { call_user_func($this->callback, $c, $r); } diff --git a/tests/client024.phpt b/tests/client024.phpt index 4e8fe2f..39949b0 100644 --- a/tests/client024.phpt +++ b/tests/client024.phpt @@ -21,7 +21,7 @@ $client->enablePipelining(false); --EXPECTF-- Test -Deprecated: Method http\Client::enableEvents() is deprecated in %sclient024.php on line %d +Deprecated: %s http\Client::enableEvents() is deprecated in %sclient024.php on line %d -Deprecated: Method http\Client::enablePipelining() is deprecated in %sclient024.php on line %d +Deprecated: %s http\Client::enablePipelining() is deprecated in %sclient024.php on line %d ===DONE=== diff --git a/tests/client029.phpt b/tests/client029.phpt index a95508c..e2cd645 100644 --- a/tests/client029.phpt +++ b/tests/client029.phpt @@ -1,13 +1,13 @@ --TEST-- client curl user handler --SKIPIF-- - +?> --FILE-- -evbase = $evbase; $this->client = $client; } - + function init($run) { $this->run = $run; } - + function timer(int $timeout_ms) { echo "T"; if (isset($this->timeout)) { @@ -44,10 +44,10 @@ class UserHandler implements http\Client\Curl\User $this->timeout->add($timeout_ms/1000); } } - + function socket($socket, int $action) { echo "S"; - + switch ($action) { case self::POLL_NONE: break; @@ -58,7 +58,7 @@ class UserHandler implements http\Client\Curl\User unset($this->ios[(int) $socket]); } break; - + default: $ev = 0; if ($action & self::POLL_IN) { @@ -68,16 +68,16 @@ class UserHandler implements http\Client\Curl\User $ev |= Event::WRITE; } if (isset($this->ios[(int) $socket])) { - $this->ios[(int) $socket]->set($this->evbase, + $this->ios[(int) $socket]->set($this->evbase, $socket, $ev, $this->onEvent($socket)); } else { - $this->ios[(int) $socket] = new Event($this->evbase, + $this->ios[(int) $socket] = new Event($this->evbase, $socket, $ev, $this->onEvent($socket)); } break; } } - + function onEvent($socket) { return function($watcher, $events) use($socket) { $action = 0; @@ -95,15 +95,15 @@ class UserHandler implements http\Client\Curl\User } }; } - + function once() { throw new BadMethodCallException("this test uses EventBase::loop()"); } - + function wait(int $timeout_ms = null) { throw new BadMethodCallException("this test uses EventBase::loop()"); } - + function send() { throw new BadMethodCallException("this test uses EventBase::loop()"); } @@ -128,5 +128,5 @@ server("proxy.inc", function($port) { ===DONE=== --EXPECTREGEX-- Test -T*[ST]+U+T*int\(200\) +([ST]+U+T*)+int\(200\) ===DONE=== diff --git a/tests/client030.phpt b/tests/client030.phpt index 5a5155e..8514b4e 100644 --- a/tests/client030.phpt +++ b/tests/client030.phpt @@ -12,7 +12,6 @@ echo "Test\n"; include "helper/server.inc"; class test implements SplObserver { - #[ReturnTypeWillChange] function update(SplSubject $client) { $client->once(); } diff --git a/tests/envresponse016.phpt b/tests/envresponse016.phpt index 3476216..8d48c93 100644 --- a/tests/envresponse016.phpt +++ b/tests/envresponse016.phpt @@ -10,7 +10,7 @@ include "skipif.inc"; echo "Test\n"; class closer extends php_user_filter { - function filter ($in, $out, &$consumed, $closing) : int { + function filter ($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { stream_bucket_append($out, $bucket); } diff --git a/tests/helper/server.inc b/tests/helper/server.inc index f203ed6..9ca96cd 100644 --- a/tests/helper/server.inc +++ b/tests/helper/server.inc @@ -24,7 +24,7 @@ if ($php) { define("PHP_BIN", PHP_BINDIR.DIRECTORY_SEPARATOR."php"); } -foreach (array("raphf", "http") as $ext) { +foreach (array("raphf", "propro", "http") as $ext) { if (!extension_loaded($ext)) { dl(ext_lib_name($ext)); } @@ -131,7 +131,7 @@ function server($handler, $cb) { $args[] = $argList[$i]; } } - foreach (['raphf', 'http'] as $ext) { + foreach (['raphf', 'propro', 'http'] as $ext) { if (null !== $arg = get_extension_load_arg(PHP_BIN, $args, $ext)) { $args[] = $arg; } diff --git a/tests/message006.phpt b/tests/message006.phpt new file mode 100644 index 0000000..4d1a693 --- /dev/null +++ b/tests/message006.phpt @@ -0,0 +1,46 @@ +--TEST-- +message var_dump with inherited property with increased access level +--SKIPIF-- + +--FILE-- +headers["foo"] = "bar"; +var_dump($m); + +?> +DONE +--EXPECTF-- +Test +object(c)#%d (9) { + ["headers"]=> + array(1) { + ["foo"]=> + string(3) "bar" + } + ["type":protected]=> + int(0) + ["body":protected]=> + NULL + ["requestMethod":protected]=> + string(0) "" + ["requestUrl":protected]=> + string(0) "" + ["responseStatus":protected]=> + string(0) "" + ["responseCode":protected]=> + int(0) + ["httpVersion":protected]=> + string(3) "1.1" + ["parentMessage":protected]=> + NULL +} +DONE diff --git a/tests/phpinfo.phpt b/tests/phpinfo.phpt index 0e557a0..c1f58d9 100644 --- a/tests/phpinfo.phpt +++ b/tests/phpinfo.phpt @@ -14,6 +14,6 @@ Done Test %a HTTP Support => enabled -Extension Version => 4.%s +Extension Version => 3.%s %a Done diff --git a/tests/propertyproxy001.phpt b/tests/propertyproxy001.phpt new file mode 100644 index 0000000..88a3543 --- /dev/null +++ b/tests/propertyproxy001.phpt @@ -0,0 +1,104 @@ +--TEST-- +property proxy +--SKIPIF-- + +--FILE-- +headers["bykey"] = 1; + var_dump($this->headers); + } + function test2() { + $h = &$this->headers; + $h["by1ref"] = 2; + var_dump($this->headers); + } + function test3() { + $x = &$this->headers["byXref"]; + + $h = &$this->headers["by2ref"]; + $h = 1; + var_dump($this->headers); + + $x = 2; + var_dump($this->headers); + } + function test4() { + $this->headers["bynext"][] = 1; + $this->headers["bynext"][] = 2; + $this->headers["bynext"][] = 3; + var_dump($this->headers); + } +} + +$m=new m; +$m->test1(); +$m->test2(); +$m->test3(); +$m->test4(); +echo $m,"\n"; + +?> +DONE +--EXPECTF-- +array(1) { + ["bykey"]=> + int(1) +} +array(2) { + ["bykey"]=> + int(1) + ["by1ref"]=> + int(2) +} +array(3) { + ["bykey"]=> + int(1) + ["by1ref"]=> + int(2) + ["by2ref"]=> + int(1) +} +array(4) { + ["bykey"]=> + int(1) + ["by1ref"]=> + int(2) + ["by2ref"]=> + int(1) + ["byXref"]=> + int(2) +} +array(5) { + ["bykey"]=> + int(1) + ["by1ref"]=> + int(2) + ["by2ref"]=> + int(1) + ["byXref"]=> + int(2) + ["bynext"]=> + array(3) { + [0]=> + int(1) + [1]=> + int(2) + [2]=> + int(3) + } +} +bykey: 1 +by1ref: 2 +by2ref: 1 +byXref: 2 +bynext: 1 +bynext: 2 +bynext: 3 + +DONE + diff --git a/tests/querystring001.phpt b/tests/querystring001.phpt new file mode 100644 index 0000000..e2e563d --- /dev/null +++ b/tests/querystring001.phpt @@ -0,0 +1,180 @@ +--TEST-- +query string +--SKIPIF-- + +--GET-- +str=abc&num=-123&dec=123.123&bool=1&arr[]=1&arr[]=2&ma[l1][l2]=2&ma[l2][l3][l4]=3 +--FILE-- +getString("str")); +var_dump($q->getInt("num")); +var_dump($q->getFloat("dec")); +var_dump($q->getInt("dec")); +var_dump($q->getFloat("dec")); +var_dump($q->getBool("bool")); +var_dump($q->getInt("bool")); +var_dump($q->getBool("num")); +var_dump($q->getInt("num")); +var_dump($q->getArray("arr")); +var_dump($q->getArray("ma")); +var_dump($q->getObject("arr")); +var_dump($q->getObject("ma")); + +$s = $q->toString(); + +printf("\nClone modifications do not alter global instance:\n"); +$q->mod(array("arr" => array(3 => 3))); +printf("%s\n", $q); + +printf("\nClone modifications do not alter standard instance:\n"); +$q2 = new http\QueryString($s); +$q3 = $q2->mod(array("arr" => array(3 => 3))); +printf("%s\n%s\n", $q2, $q3); +#var_dump($q2, $q3); + +printf("\nIterator:\n"); +$it = new RecursiveIteratorIterator($q2, RecursiveIteratorIterator::SELF_FIRST); +foreach ($it as $k => $v) { + $i = $it->getDepth()*8; + @printf("%{$i}s: %s\n", $k, $v); +} + +printf("\nReplace a multi dimensional key:\n"); +printf("%s\n", $q2->mod(array("ma" => null))->set(array("ma" => array("l1" => false)))); + +printf("\nXlate:\n"); +$qu = new http\QueryString("ü=ö"); +printf("utf8: %s\n", $qu); +printf("latin1: %s\n", method_exists($qu, "xlate") ? $qu->xlate("utf-8", "latin1") : "%FC=%F6"); + +printf("\nOffsets:\n"); +var_dump($q2["ma"]); +$q2["ma"] = array("bye"); +var_dump($q2["ma"]); +var_dump(isset($q2["ma"])); +unset($q2["ma"]); +var_dump(isset($q2["ma"])); + +echo "Done\n"; +?> +--EXPECTF-- +Test + +Global instance: +str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 + +Standard getters: +string(3) "abc" +int(-123) +float(123.123) +int(123) +float(123.123) +bool(true) +int(1) +bool(true) +int(-123) +array(2) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" +} +array(2) { + ["l1"]=> + array(1) { + ["l2"]=> + string(1) "2" + } + ["l2"]=> + array(1) { + ["l3"]=> + array(1) { + ["l4"]=> + string(1) "3" + } + } +} +object(stdClass)#%d (2) { + [0]=> + string(1) "1" + [1]=> + string(1) "2" +} +object(stdClass)#%d (2) { + ["l1"]=> + array(1) { + ["l2"]=> + string(1) "2" + } + ["l2"]=> + array(1) { + ["l3"]=> + array(1) { + ["l4"]=> + string(1) "3" + } + } +} + +Clone modifications do not alter global instance: +str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 + +Clone modifications do not alter standard instance: +str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 +str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&arr%5B3%5D=3&ma%5Bl1%5D%5Bl2%5D=2&ma%5Bl2%5D%5Bl3%5D%5Bl4%5D=3 + +Iterator: +str: abc +num: -123 +dec: 123.123 +bool: 1 +arr: Array + 0: 1 + 1: 2 +ma: Array + l1: Array + l2: 2 + l2: Array + l3: Array + l4: 3 + +Replace a multi dimensional key: +str=abc&num=-123&dec=123.123&bool=1&arr%5B0%5D=1&arr%5B1%5D=2&ma%5Bl1%5D= + +Xlate: +utf8: %C3%BC=%C3%B6 +latin1: %FC=%F6 + +Offsets: +array(2) { + ["l1"]=> + array(1) { + ["l2"]=> + string(1) "2" + } + ["l2"]=> + array(1) { + ["l3"]=> + array(1) { + ["l4"]=> + string(1) "3" + } + } +} +array(1) { + [0]=> + string(3) "bye" +} +bool(true) +bool(false) +Done