-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Closed
Copy link
Labels
Component: TestFrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPAPPartners acceleration programPartners acceleration programProject: GraphQLReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch
Milestone
Description
Preconditions (*)
Magento v2.3.3
Steps to reproduce (*)
- Make a call with the
GraphQlAbstract::graphQlQueryWithResponseHeaders
- Have a header in the response like:
Access-Control-Allow-Origin: https://www.example.com
- See that the header does NOT show up in the headers array
Expected result (*)
- Have a header in the headers array like:
['Access-Control-Allow-Origin'] => 'https://www.example.com'
Actual result (*)
See above.
This is due to a failed preg_split
logic in:
/**
* Parse response headers into associative array
*
* @param string $headers
* @return array
*/
private function processResponseHeaders(string $headers): array
{
$headersArray = [];
$headerLines = preg_split('/((\r?\n)|(\r\n?))/', $headers);
foreach ($headerLines as $headerLine) {
$headerParts = preg_split('/: /', $headerLine);
if (count($headerParts) == 2) {
$headersArray[trim($headerParts[0])] = trim($headerParts[1]);
} elseif (preg_match('/HTTP\/[\.0-9]+/', $headerLine)) {
$headersArray[trim('Status-Line')] = trim($headerLine);
}
}
return $headersArray;
}
It should preg_split
with a limit of 2
:
$headerParts = preg_split('/: /', $headerLine, 2);
Metadata
Metadata
Assignees
Labels
Component: TestFrameworkIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentPAPPartners acceleration programPartners acceleration programProject: GraphQLReproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchThe issue has been reproduced on latest 2.4-develop branch