Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Re-roll pull/302 patch for compatibility with php-vcr 1.5.5.#404

Open
bwood wants to merge 2 commits intophp-vcr:1.5from
bwood:1.5.5-parseResponse-undefined-offset-1
Open

Re-roll pull/302 patch for compatibility with php-vcr 1.5.5.#404
bwood wants to merge 2 commits intophp-vcr:1.5from
bwood:1.5.5-parseResponse-undefined-offset-1

Conversation

@bwood
Copy link
Contributor

@bwood bwood commented Feb 23, 2024

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 $response argument. In this case php-VCR emits

PHP Notice:  Undefined offset: 1 in /opt/WpsConsole/vendor/php-vcr/php-vcr/src/VCR/Util/HttpUtil.php on line 70

which 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant