* Use WeakMap for active handle tracking
- Replaces array-based tracking with PHP 8.0 \WeakMap
- Replaces an O(N) lookup with an O(1) lookup in the MultiCurl execution loop
* Fix tests
* Clean up
* Simplify MultiCurl execution loop
- Removes legacy workarounds
- Deprecates MultiCurl::setRequestTimeAccuracy()
- Removes use of CURLM_CALL_MULTI_PERFORM ("As of cURL 7.20.0, this constant is not used")
* Rate limit fix
If $elapsed_seconds > $this->intervalSeconds the first time hasRequestQuota() is called, rateLimitReached is never set to true and the limit is not enforced
This can happen if the rate limit is set in a callback function some time after starting
I completely removed $rateLimitReached since its only use was in the removed condition check
Alternatively, it should be possible to reinitialize currentStartTime when setRateLimit is called, but I still don't really see the usefulness of resetting the timer only when the limit was reached in the previous interval
* Rename variable
* Clean up
---------
Co-authored-by: Riccardo Nava <116394015+ricnava00@users.noreply.github.com>
* Add shims for PHPUnit
* Fix PHPUnit error: undefined method returnValue()
1) CurlTest\PHPCurlClassTest::testMock
Error: Call to undefined method CurlTest\PHPCurlClassTest::returnValue()
* Fix PHPUnit risky test by restoring error handler before exception thrown
There was 1 risky test:
1) CurlTest\PHPCurlClassTest::testRequiredOptionCurlOptReturnTransferEmitsWarningPHPUnit10Plus
Test code or tested code did not remove its own error handlers
* Fix psalm errors
* Add attributes for version constraint
* Temporarily pin psalm to fix ci
FILE: ...e/runner/work/php-curl-class/php-curl-class/tests/PHPCurlClass/UrlTest.php
--------------------------------------------------------------------------------
FOUND 0 ERRORS AND 2 WARNINGS AFFECTING 2 LINES
--------------------------------------------------------------------------------
14 | WARNING | The $escape parameter must be passed when calling fgetcsv() as
| | its default value will change in a future PHP version.
| | (PHPCompatibility.ParameterValues.RemovedProprietaryCSVEscaping.DeprecatedParamNotPassed)
15 | WARNING | The $escape parameter must be passed when calling fgetcsv() as
| | its default value will change in a future PHP version.
| | (PHPCompatibility.ParameterValues.RemovedProprietaryCSVEscaping.DeprecatedParamNotPassed)
--------------------------------------------------------------------------------
This change attempts to determine which underlying constants were
bitmasked together to reach the resulting value passed to curl_setopt()
using Curl::setOpt().
Fix setting of options by passing of MultiCurl options to new Curl
instances earlier. Set options during the Curl initialization instead of
waiting until the request instance is configured in
MultiCurl::initHandle().
PHP 8 error messages:
TypeError: array_keys(): Argument #1 ($array) must be of type array, stdClass given
TypeError: array_values(): Argument #1 ($array) must be of type array, stdClass given
PHP 7 error messages:
TypeError: array_keys() expects parameter 1 to be array, object given
TypeError: array_values() expects parameter 1 to be array, object given