mirror of
https://github.com/php/php-src.git
synced 2025-08-16 22:18:50 +02:00
Fix #79497: Fix php_openssl_subtract_timeval()
I stumbled upon this while debugging a strange issue with stream_socket_client() where it randomly throws out errors when the connection timeout is set to below 1s. The logic to calculate time difference in php_openssl_subtract_timeval() is wrong when a.tv_usec < b.tv_usec, causing connection errors before the timeout is reached.
This commit is contained in:
parent
d31ccb5fc8
commit
94e09bfe55
2 changed files with 6 additions and 2 deletions
4
NEWS
4
NEWS
|
@ -15,6 +15,10 @@ PHP NEWS
|
||||||
. Fixed bug #79441 (Segfault in mb_chr() if internal encoding is unsupported).
|
. Fixed bug #79441 (Segfault in mb_chr() if internal encoding is unsupported).
|
||||||
(Girgias)
|
(Girgias)
|
||||||
|
|
||||||
|
- OpenSSL:
|
||||||
|
. Fixed bug #79497 (stream_socket_client() throws an unknown error sometimes
|
||||||
|
with <1s timeout). (Joe Cai)
|
||||||
|
|
||||||
- Standard:
|
- Standard:
|
||||||
. Fixed bug #79468 (SIGSEGV when closing stream handle with a stream filter
|
. Fixed bug #79468 (SIGSEGV when closing stream handle with a stream filter
|
||||||
appended). (dinosaur)
|
appended). (dinosaur)
|
||||||
|
|
|
@ -2209,8 +2209,8 @@ static struct timeval php_openssl_subtract_timeval(struct timeval a, struct time
|
||||||
difference.tv_usec = a.tv_usec - b.tv_usec;
|
difference.tv_usec = a.tv_usec - b.tv_usec;
|
||||||
|
|
||||||
if (a.tv_usec < b.tv_usec) {
|
if (a.tv_usec < b.tv_usec) {
|
||||||
b.tv_sec -= 1L;
|
difference.tv_sec -= 1L;
|
||||||
b.tv_usec += 1000000L;
|
difference.tv_usec += 1000000L;
|
||||||
}
|
}
|
||||||
|
|
||||||
return difference;
|
return difference;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue