Closed javabudd closed 5 years ago
There was new logic added to the Client and Socket adapters to apply an integer/numeric check (https://github.com/zendframework/zend-http/commit/5b36ca3daf51a02763c409a291f0e7c79b9828cc, https://github.com/zendframework/zend-http/commit/4dc2c305864986624ec7156962015ed76ba54f48) that is not working as expected.
if ($connectTimeout !== null && (! is_int($connectTimeout) || ! is_numeric($connectTimeout))) { throw new AdapterException\InvalidArgumentException(sprintf( 'integer or numeric string expected, got %s', gettype($connectTimeout) )); }
If $connectTimeout is a numeric string, ! is_int($connectTimeout) will return true and the exception will be thrown without is_numeric being called.
$client = new \Zend\Http\Client(); $client->setOptions(['timeout' => '20']); $request = new \Zend\Http\Request(); $client->dispatch($request);
Timeout should be validated properly since it's a numeric string.
Exception is thrown integer or numeric string expected, got string.
integer or numeric string expected, got string
My team ran into this exact issue.
Please see #168
There was new logic added to the Client and Socket adapters to apply an integer/numeric check (https://github.com/zendframework/zend-http/commit/5b36ca3daf51a02763c409a291f0e7c79b9828cc, https://github.com/zendframework/zend-http/commit/4dc2c305864986624ec7156962015ed76ba54f48) that is not working as expected.
If $connectTimeout is a numeric string, ! is_int($connectTimeout) will return true and the exception will be thrown without is_numeric being called.
Code to reproduce the issue
Expected results
Timeout should be validated properly since it's a numeric string.
Actual results
Exception is thrown
integer or numeric string expected, got string
.