You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to retrieve a document using the get() method in Client.php of opensearch-php, if the server returns an error (e.g., 502 Bad Gateway), the response is in HTML format.
During the deserialization of the response body, it appears that the content type is being checked. However, the response is being incorrectly identified as JSON, causing json_decode() to be executed on the HTML response.
As a result, proper error handling does not occur when the OpenSearch server fails, which may lead to application crashes if exception handling is not implemented.
How can one reproduce the bug?
Put a high load on OpenSearch to trigger a 502 Bad Gateway error.
Call the get() method in opensearch-php.
The response returned is an HTML 502 Bad Gateway page.
json_decode() is executed, resulting in a JsonException with a Syntax error.
What is the expected behavior?
Proper error handling should occur when OpenSearch returns an error response.
What is the bug?
When attempting to retrieve a document using the get() method in Client.php of opensearch-php, if the server returns an error (e.g., 502 Bad Gateway), the response is in HTML format.
During the deserialization of the response body, it appears that the content type is being checked. However, the response is being incorrectly identified as JSON, causing json_decode() to be executed on the HTML response.
As a result, proper error handling does not occur when the OpenSearch server fails, which may lead to application crashes if exception handling is not implemented.
How can one reproduce the bug?
What is the expected behavior?
Proper error handling should occur when OpenSearch returns an error response.
What is your host/environment?
OS: amazon linux2
php version: 8.3
OpenSearch version: 1.2
Do you have any screenshots?
no
Do you have any additional context?
no
The text was updated successfully, but these errors were encountered: