diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1873f025b8..ff838cd55d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -4,6 +4,8 @@ updates: directory: "/" schedule: interval: "daily" + versioning-strategy: "increase" + - package-ecosystem: "github-actions" directory: "/" schedule: @@ -12,7 +14,9 @@ updates: - "cleanup-no-release-required" - "dependencies" - "github_actions" + - package-ecosystem: "pip" directory: "/" schedule: interval: "daily" + versioning-strategy: "increase" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0513e41184..d8b5edc012 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,6 @@ jobs: strategy: matrix: php-version: - - '7.0' - '7.1' - '7.2' - '7.3' diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 6f62e26b81..0182aa39d8 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Dependabot metadata id: dependabot-metadata - uses: dependabot/fetch-metadata@v2.0.0 + uses: dependabot/fetch-metadata@v2.2.0 - name: Approve and label updates run: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d781e6599..0966ee676d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,13 +12,13 @@ # $ pre-commit autoupdate repos: - repo: https://github.com/psf/black - rev: 24.3.0 + rev: 24.8.0 hooks: - id: black name: black entry: black - repo: https://github.com/pycqa/flake8 - rev: 7.0.0 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/pycqa/isort diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e2e43fe7a..b52061cc90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ backwards-incompatible changes that will affect existing usage. +## 10.0.0 - 2024-08-20 + +- Drop support for PHP 7.0 ([#880](https://github.com/php-curl-class/php-curl-class/pull/880)) +- Add public method getActiveCurls ([#871](https://github.com/php-curl-class/php-curl-class/pull/871)) + ## 9.19.2 - 2024-04-09 - Fix CI: Use nullable type declaration ([#859](https://github.com/php-curl-class/php-curl-class/pull/859)) diff --git a/README.md b/README.md index d825f7a9d3..3e454c8727 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Installation instructions to use the `composer` command can be found on https:// ### Requirements -PHP Curl Class works with PHP 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, 7.1, and 7.0. +PHP Curl Class works with PHP 8.3, 8.2, 8.1, 8.0, 7.4, 7.3, 7.2, and 7.1. ### Quick Start and Examples diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index 7d62a0cd3f..3b4cb9f2ed 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -48,12 +48,12 @@ $curl->get('https://www.example.com/'); echo 'error: ' . $curl->error . "\n"; echo 'errorCode: ' . $curl->errorCode . "\n"; echo 'errorMessage: ' . $curl->errorMessage . "\n"; -echo 'curlError: ' . $curlError . "\n"; -echo 'curlErrorCode: ' . $curlErrorCode . "\n"; -echo 'curlErrorMessage: ' . $curlErrorMessage . "\n"; -echo 'httpError: ' . $httpError . "\n"; -echo 'httpStatusCode: ' . $httpStatusCode . "\n"; -echo 'httpErrorMessage: ' . $httpErrorMessage . "\n"; +echo 'curlError: ' . $curl->error . "\n"; +echo 'curlErrorCode: ' . $curl->errorCode . "\n"; +echo 'curlErrorMessage: ' . $curl->errorMessage . "\n"; +echo 'httpError: ' . $curl->httpError . "\n"; +echo 'httpStatusCode: ' . $curl->httpStatusCode . "\n"; +echo 'httpErrorMessage: ' . $curl->httpErrorMessage . "\n"; echo 'requestHeaders:' . "\n"; var_dump($curl->requestHeaders); echo 'responseHeaders:' . "\n"; diff --git a/composer.json b/composer.json index 6641a2d64f..ea8d153ac0 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=7.0", + "php": ">=7.1", "ext-curl": "*" }, "require-dev": { @@ -29,7 +29,7 @@ "phpcsstandards/phpcsutils": "@alpha", "phpunit/phpunit": "*", "squizlabs/php_codesniffer": "*", - "vimeo/psalm": ">=0.3.63" + "vimeo/psalm": ">=2" }, "suggest": { "ext-mbstring": "*" diff --git a/scripts/make_release_recreate.sh b/scripts/make_release_recreate.sh new file mode 100755 index 0000000000..0d2892b87f --- /dev/null +++ b/scripts/make_release_recreate.sh @@ -0,0 +1,6 @@ +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +cd "${SCRIPT_DIR}" + +rm -v "make_release_requirements.txt" + +pip-compile --output-file="make_release_requirements.txt" "make_release_requirements.in" diff --git a/scripts/make_release_requirements.txt b/scripts/make_release_requirements.txt index f182cea5ce..e325a4d70a 100644 --- a/scripts/make_release_requirements.txt +++ b/scripts/make_release_requirements.txt @@ -4,41 +4,41 @@ # # pip-compile --output-file=make_release_requirements.txt make_release_requirements.in # -certifi==2023.7.22 +certifi==2024.7.4 # via requests -cffi==1.15.1 +cffi==1.16.0 # via # cryptography # pynacl -charset-normalizer==3.2.0 +charset-normalizer==3.3.2 # via requests -cryptography==42.0.4 +cryptography==42.0.5 # via pyjwt deprecated==1.2.14 # via pygithub -gitdb==4.0.10 +gitdb==4.0.11 # via gitpython gitpython==3.1.43 - # via -r scripts/make_release_requirements.in -idna==3.4 + # via -r make_release_requirements.in +idna==3.7 # via requests -pycparser==2.21 +pycparser==2.22 # via cffi pygithub==2.3.0 - # via -r scripts/make_release_requirements.in + # via -r make_release_requirements.in pyjwt[crypto]==2.8.0 # via pygithub pynacl==1.5.0 # via pygithub -requests==2.31.0 +requests==2.32.0 # via pygithub -smmap==5.0.0 +smmap==5.0.1 # via gitdb -typing-extensions==4.8.0 +typing-extensions==4.11.0 # via pygithub -urllib3==2.0.7 +urllib3==2.2.2 # via # pygithub # requests -wrapt==1.15.0 +wrapt==1.16.0 # via deprecated diff --git a/src/Curl/Curl.php b/src/Curl/Curl.php index 04cbcd95c8..5022be0783 100644 --- a/src/Curl/Curl.php +++ b/src/Curl/Curl.php @@ -6,8 +6,8 @@ class Curl extends BaseCurl { - const VERSION = '9.19.2'; - const DEFAULT_TIMEOUT = 30; + public const VERSION = '10.0.0'; + public const DEFAULT_TIMEOUT = 30; public $curl = null; public $id = null; diff --git a/src/Curl/MultiCurl.php b/src/Curl/MultiCurl.php index 362a8a4bcd..5f3d9f617c 100644 --- a/src/Curl/MultiCurl.php +++ b/src/Curl/MultiCurl.php @@ -942,4 +942,9 @@ private function waitUntilRequestQuotaAvailable() $this->currentRequestCount = 0; } + + public function getActiveCurls() + { + return $this->activeCurls; + } } diff --git a/tests/Helper.php b/tests/Helper.php index 50b6886cd2..55609a8148 100644 --- a/tests/Helper.php +++ b/tests/Helper.php @@ -8,8 +8,8 @@ class Test { - const TEST_URL = 'http://127.0.0.1:8000/'; - const ERROR_URL = 'http://1.2.3.4/'; + public const TEST_URL = 'http://127.0.0.1:8000/'; + public const ERROR_URL = 'http://1.2.3.4/'; public $message; diff --git a/tests/PHPCurlClass/PHPCurlClassTest.php b/tests/PHPCurlClass/PHPCurlClassTest.php index d2033ae9cf..857b019754 100644 --- a/tests/PHPCurlClass/PHPCurlClassTest.php +++ b/tests/PHPCurlClass/PHPCurlClassTest.php @@ -3401,12 +3401,6 @@ public function testRequestMethodSuccessiveSearchRequests() public function testMemoryLeak() { - // Skip memory leak test failing for PHP 7. - // "Failed asserting that 8192 is less than 1000." - if (getenv('CI_PHP_VERSION') === '7.0') { - $this->markTestSkipped(); - } - ob_start(); echo '['; for ($i = 0; $i < 10; $i++) { diff --git a/tests/check_coding_standards.sh b/tests/check_coding_standards.sh index 1ffc78b8c8..d4d0ae7ca3 100755 --- a/tests/check_coding_standards.sh +++ b/tests/check_coding_standards.sh @@ -93,8 +93,7 @@ if [[ ! -z "${elses}" ]]; then fi # Run PHP_CodeSniffer. -if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then : -elif [[ "${CI_PHP_VERSION}" == "7.1" ]]; then : +if [[ "${CI_PHP_VERSION}" == "7.1" ]]; then : else # Determine which phpcs to use. @@ -121,8 +120,7 @@ else fi # Run PHP-CS-Fixer. -if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then : -elif [[ "${CI_PHP_VERSION}" == "7.1" ]]; then : +if [[ "${CI_PHP_VERSION}" == "7.1" ]]; then : elif [[ "${CI_PHP_VERSION}" == "7.2" ]]; then : elif [[ "${CI_PHP_VERSION}" == "7.3" ]]; then : else diff --git a/tests/ci.sh b/tests/ci.sh index 726fda8fa8..6b5489cc1d 100755 --- a/tests/ci.sh +++ b/tests/ci.sh @@ -57,18 +57,6 @@ phpunit_v10_shim() { remove_expectWarning } -php_v7_0_shim() { - # -protected function setUp(): void - # +protected function setUp() - find='protected function setUp(): void' - replace='protected function setUp()' - if sed v < /dev/null 2> /dev/null; then - sed -i"" -e"s/${find}/${replace}/" "./PHPCurlClass/PHP"* - else - sed -i "" -e"s/${find}/${replace}/" "./PHPCurlClass/PHP"* - fi -} - set -x composer self-update @@ -132,10 +120,6 @@ elif [[ "${phpunit_version}" == "10."* ]]; then phpunit_args=" --display-incomplete --display-skipped --display-deprecations --display-errors --display-notices --display-warnings --fail-on-risky ${extra_args}" fi -if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then - php_v7_0_shim -fi - # Run tests. "${phpunit_to_use}" --version "${phpunit_to_use}" \ diff --git a/tests/dockerfiles/php70/1_build.sh b/tests/dockerfiles/php70/1_build.sh deleted file mode 100755 index 54f767bd76..0000000000 --- a/tests/dockerfiles/php70/1_build.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Build an image. -set -x -docker build --tag="php-curl-class/php70" . diff --git a/tests/dockerfiles/php70/2_start.sh b/tests/dockerfiles/php70/2_start.sh deleted file mode 100755 index 15d1e503dc..0000000000 --- a/tests/dockerfiles/php70/2_start.sh +++ /dev/null @@ -1,15 +0,0 @@ -# Run image to create container. - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -set -x -cd "${SCRIPT_DIR}/../../.." -project_dir="${PWD}" - -docker start "php70" || - docker run \ - --detach \ - --interactive \ - --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ - --name="php70" \ - --tty \ - "php-curl-class/php70" diff --git a/tests/dockerfiles/php70/3_test.sh b/tests/dockerfiles/php70/3_test.sh deleted file mode 100755 index 6ba37b2425..0000000000 --- a/tests/dockerfiles/php70/3_test.sh +++ /dev/null @@ -1,17 +0,0 @@ -# Run tests inside container. -command=$(cat <<-END -mkdir --parents "/tmp/php-curl-class" && -rsync --delete --exclude=".git" --exclude="vendor" --exclude="composer.lock" --links --recursive "/data/" "/tmp/php-curl-class/" && -cd "/tmp/php-curl-class" && -export CI_PHP_VERSION="7.0" && -( - [ ! -f "/tmp/.composer_updated" ] && - composer --no-interaction update && - touch "/tmp/.composer_updated" || - exit 0 -) && -bash "tests/run.sh" -END -) -set -x -docker exec --tty "php70" sh -c "${command}" diff --git a/tests/dockerfiles/php70/4_stop.sh b/tests/dockerfiles/php70/4_stop.sh deleted file mode 100755 index 31563f4c7f..0000000000 --- a/tests/dockerfiles/php70/4_stop.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Stop container. -set -x -docker stop "php70" diff --git a/tests/dockerfiles/php70/Dockerfile b/tests/dockerfiles/php70/Dockerfile deleted file mode 100644 index 449fb18fb0..0000000000 --- a/tests/dockerfiles/php70/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM php:7.0-cli -ENV DEBIAN_FRONTEND noninteractive - -RUN apt-get --assume-yes --quiet update - -RUN apt-get --assume-yes --quiet install git && \ - apt-get --assume-yes --quiet install libpng-dev && \ - apt-get --assume-yes --quiet install zip - -RUN curl --silent --show-error "https://getcomposer.org/installer" | php && \ - mv "composer.phar" "/usr/local/bin/composer" && \ - composer global require --no-interaction "phpunit/phpunit" - -RUN docker-php-ext-configure gd && \ - docker-php-ext-install gd - -ENV PATH /root/.composer/vendor/bin:$PATH -CMD ["bash"] diff --git a/tests/dockerfiles/php70/attach.sh b/tests/dockerfiles/php70/attach.sh deleted file mode 100755 index 2a09b80a48..0000000000 --- a/tests/dockerfiles/php70/attach.sh +++ /dev/null @@ -1,3 +0,0 @@ -# Attach to running container. - -docker exec --interactive --tty "php70" bash -l diff --git a/tests/dockerfiles/php70/run.sh b/tests/dockerfiles/php70/run.sh deleted file mode 100755 index ced63cf365..0000000000 --- a/tests/dockerfiles/php70/run.sh +++ /dev/null @@ -1,23 +0,0 @@ -bash "1_build.sh" -if [[ $? -ne 0 ]]; then - echo "Error: Build failed" - exit 1 -fi - -bash "2_start.sh" -if [[ $? -ne 0 ]]; then - echo "Error: Start failed" - exit 1 -fi - -bash "3_test.sh" -if [[ $? -ne 0 ]]; then - echo "Error: Test failed" - exit 1 -fi - -bash "4_stop.sh" -if [[ $? -ne 0 ]]; then - echo "Error: Stop failed" - exit 1 -fi diff --git a/tests/dockerfiles/php70/run_interactive.sh b/tests/dockerfiles/php70/run_interactive.sh deleted file mode 100755 index a089e63516..0000000000 --- a/tests/dockerfiles/php70/run_interactive.sh +++ /dev/null @@ -1,14 +0,0 @@ -# Run image to create container and attach to it. - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -set -x -cd "${SCRIPT_DIR}/../../.." -project_dir="${PWD}" - -docker run \ - --interactive \ - --mount "type=bind,src=${project_dir},dst=/data,readonly=true" \ - --name="php70" \ - --rm \ - --tty \ - "php-curl-class/php70" /bin/bash diff --git a/tests/ruleset.xml b/tests/ruleset.xml index 1886bc4fac..a52783b81d 100644 --- a/tests/ruleset.xml +++ b/tests/ruleset.xml @@ -13,9 +13,6 @@ - - - diff --git a/tests/run.sh b/tests/run.sh index c3472fede7..ca4c2ca7f1 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -57,18 +57,6 @@ phpunit_v10_shim() { remove_expectWarning } -php_v7_0_shim() { - # -protected function setUp(): void - # +protected function setUp() - find='protected function setUp(): void' - replace='protected function setUp()' - if sed v < /dev/null 2> /dev/null; then - sed -i"" -e"s/${find}/${replace}/" "./PHPCurlClass/PHP"* - else - sed -i "" -e"s/${find}/${replace}/" "./PHPCurlClass/PHP"* - fi -} - set -x # Use composer's phpunit and phpcs by adding composer bin directory to the path environment variable. @@ -129,10 +117,6 @@ elif [[ "${phpunit_version}" == "10."* ]]; then phpunit_args=" --display-incomplete --display-skipped --display-deprecations --display-errors --display-notices --display-warnings --fail-on-risky ${extra_args}" fi -if [[ "${CI_PHP_VERSION}" == "7.0" ]]; then - php_v7_0_shim -fi - # Run tests. "${phpunit_to_use}" --version "${phpunit_to_use}" \