Memory leak issue when response headers are empty
combinator opened this issue · 1 comments
combinator commented
What steps will reproduce the problem?
Create a client object .
Submit request .
If headers are empty, the script dies due to fatal error.
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /var/www/app_root/vendor/yiisoft/yii2-httpclient/src/Response.php on line 62
PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes)'
in /var/www/app_root/vendor/yiisoft/yii2-httpclient/src/Response.php:62
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
What's expected?
Script should not generate any errors
What do you get instead?
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /var/www/app_root/vendor/yiisoft/yii2-httpclient/src/Response.php on line 62
PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes)'
in /var/www/app_root/vendor/yiisoft/yii2-httpclient/src/Response.php:62
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
RESPONSE
yii\httpclient\Response Object
(
[client] => yii\httpclient\Client Object
(
[baseUrl] => https://sandbox.xxxx.com
[formatters] => Array
(
[json] => yii\httpclient\JsonFormatter Object
(
[encodeOptions] => 0
)
)
[parsers] => Array
(
)
[requestConfig] => Array
(
[format] => json
)
[responseConfig] => Array
(
[format] => json
)
[contentLoggingMaxSize] => 2000
[_transport:yii\httpclient\Client:private] => yii\httpclient\CurlTransport Object
(
[_events:yii\base\Component:private] => Array
(
)
[_eventWildcards:yii\base\Component:private] => Array
(
)
[_behaviors:yii\base\Component:private] =>
)
[_events:yii\base\Component:private] => Array
(
)
[_eventWildcards:yii\base\Component:private] => Array
(
)
[_behaviors:yii\base\Component:private] => Array
(
)
)
[_headers:yii\httpclient\Message:private] => yii\web\HeaderCollection Object
(
[_headers:yii\web\HeaderCollection:private] => Array
(
[http-code] => Array
(
[0] => 500
)
[content-length] => Array
(
[0] => 0
)
[request-context] => Array
(
[0] => appId=cid-v1:e996501c-e721-4ac1-97ff-dc6887b85e8c
)
[date] => Array
(
[0] => Tue, 11 Aug 2020 18:34:35 GMT
)
)
)
[_cookies:yii\httpclient\Message:private] =>
[_content:yii\httpclient\Message:private] =>
[_data:yii\httpclient\Message:private] =>
[_format:yii\httpclient\Message:private] => json
[_events:yii\base\Component:private] => Array
(
)
[_eventWildcards:yii\base\Component:private] => Array
(
)
[_behaviors:yii\base\Component:private] =>
)
Additional info
Q | A |
---|---|
Yii version | 2.0.35 |
Yii HTTP Client version | 2.0.12.0 |
PHP version | 7.4.6 |
Operating system | Centos 7 3.10.0-1127.8.2.el7.x86_64 |
combinator commented
the issue was related to an infinite loop in the code.
Closing the issue