1.5.5 parse response undefined offset 1#403
Open
bwood wants to merge 52 commits intophp-vcr:masterfrom
Open
Conversation
Fix issue where dispatch() was called with wrong order of parameters when using Codeception 4.1.15 or higher which added a class alias for EventDispatcher\Event. Using recommendation by @Naktibalda to detect which version of dispatch method must be used
(cherry picked from commit 87f2a5a)
(cherry picked from commit 783a29a)
(cherry picked from commit 444c810)
(cherry picked from commit 70d1623)
(cherry picked from commit a78277f)
(cherry picked from commit e22c1d6) # Conflicts: # .github/workflows/tests.yml # composer.json # phpstan.neon # tests/Integration/Guzzle/AsyncTest.php # tests/Integration/Guzzle/ErrorTest.php # tests/Integration/Soap/ExampleSoapClient.php # tests/Integration/Soap/ExampleSoapClientTest.php # tests/Unit/CassetteTest.php # tests/Unit/CodeTransform/AbstractCodeTransformTest.php # tests/Unit/CodeTransform/CurlCodeTransformTest.php # tests/Unit/CodeTransform/SoapCodeTransformTest.php # tests/Unit/ConfigurationTest.php # tests/Unit/Event/AfterHttpRequestEventTest.php # tests/Unit/Event/AfterPlaybackEventTest.php # tests/Unit/Event/BeforeHttpRequestEventTest.php # tests/Unit/Event/BeforePlaybackEventTest.php # tests/Unit/Event/BeforeRecordEventTest.php # tests/Unit/LibraryHooks/CurlHookTest.php # tests/Unit/LibraryHooks/SoapHookTest.php # tests/Unit/LibraryHooks/StreamWrapperHookTest.php # tests/Unit/RequestMatcherTest.php # tests/Unit/RequestTest.php # tests/Unit/ResponseTest.php # tests/Unit/Storage/AbstractStorageTest.php # tests/Unit/Storage/BlackholeTest.php # tests/Unit/Storage/JsonTest.php # tests/Unit/Storage/YamlTest.php # tests/Unit/Util/CurlHelperTest.php # tests/Unit/Util/HttpClientTest.php # tests/Unit/Util/HttpUtilTest.php # tests/Unit/Util/SoapClientTest.php # tests/Unit/Util/StreamHelperTest.php # tests/Unit/Util/StreamProcessorTest.php # tests/Unit/Util/TextUtilTest.php # tests/Unit/VCRFactoryTest.php # tests/Unit/VCRTest.php # tests/Unit/VideorecorderTest.php # tests/bootstrap.php # tests/integration/guzzle/5/ExampleHttpClient.php # tests/integration/guzzle/6/ExampleHttpClient.php # tests/integration/guzzle/test/VCR/Example/ExampleHttpClientTest.php # tests/integration/guzzle/test/bootstrap.php # tests/integration/soap/test/bootstrap.php
# Conflicts: # .github/workflows/continuous integration.yml
…le Cassette to playback and record request/responses at a given index. Do not require Cassette to manage index state. (cherry picked from commit 7590bbc)
…ry API changes. (cherry picked from commit 9f971f6)
…ed or inserted. (cherry picked from commit 3aa54e8)
… the recording index. (cherry picked from commit 9037b98)
…y exists in the cassette. (cherry picked from commit d5adfb4)
(cherry picked from commit edb27bd)
… no index keys playback. (cherry picked from commit 074fb85)
…ed cassettes playback multiple identical requests correctly. (cherry picked from commit 1011e40)
…is called as part of eject() and insertCassette(). (cherry picked from commit 5cdd0a0)
(cherry picked from commit 37bafc7)
(cherry picked from commit ad35687)
(with and without legacy entries) (cherry picked from commit ce1471b)
(cherry picked from commit a95298b)
(cherry picked from commit 457326c)
…te have to handle legacy entries Because the Videorecorder increments the index for each identical requests it also passes it to the cassette, so the cassette have to handle legacy stored entries. So if no index is present while loading recorded requests we have to set the index to searched one (instead of zero) to always match (disabled the feature), when all other matchers match. (cherry picked from commit 9672154)
(cherry picked from commit 63de5ce)
…ests [1.5] Record identical requests
php-vcr#336 Proper Detection of EventDispatcherInterface [1.5]
... because of deprecation layer if - else
First read the whole stream and afterwards perform code transformations. This will ensure to also replace code, which is divided into chunks while reading a file. Fixes php-vcr#268 and php-vcr#383 (cherry picked from commit 1917d66)
…nsformation-on-streams-which-are-divided-into-several-chunks FIX: Read the whole stream and perform code transformations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
This is a re-roll of #302 to achieve a patch that is compatible with php-vcr 1.5.5.
As mentioned in #272, it's possible for HttpUtil::parseResponse() to receive a empty
$responseargument. In this case php-VCR emitswhich causes a Behat test to fail.
What has been done
Use
array_pad()to ensure that the array created from an empty response argument has at least two empty elements.Add HttpUtilTest::parseResponseNull() to assert correct behavior if the response is null.
How to test
In my case I needed to create a new fixture for a [getUser()|https://docs.aws.amazon.com/IAM/latest/APIReference/API_GetUser.html] call to AWS IAM. Doing that exposed this bug.
Notes
I used the same approach as #242