1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

300 Commits

Author SHA1 Message Date
ndossche
bfd66bbdf0 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix compile warnings under GCC 15.2.1 (#21320)
  Updated to version 2026.1 (2026a)
2026-03-02 23:13:40 +01:00
ndossche
210704258a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix compile warnings under GCC 15.2.1 (#21320)
2026-03-02 23:12:48 +01:00
Nora Dossche
583be5a8ca Fix compile warnings under GCC 15.2.1 (#21320)
The compiler now infers constness through string functions.
Adhere to that.
It also now warns about using multiplications in conditions.
2026-03-02 23:12:06 +01:00
Jakub Zelenka
0fd8aae6e8 Fix TCP_KEEPALIVE no inheriting for accepted sockets on MacOS 2025-12-30 16:53:22 +01:00
Jakub Zelenka
9582d8e6d7 Add stream socket keepalive context options
This adds so_keepalive, tcp_keepidle, tcp_keepintvl and tcp_keepcnt
stream socket context options that are used to set their upper case
C macro variants by setsockopt function.

The test requires sockets extension and just tests that the values are
being set. This is because a real test would be slow and difficult to
show that those options really work due to how they work internally.

Closes GH-20381
2025-12-30 16:52:22 +01:00
David Carlier
71d11bdb16 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20601: ftp_connect() timeout argument overflow.
2025-11-29 23:06:41 +00:00
David Carlier
227541cb96 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20601: ftp_connect() timeout argument overflow.
2025-11-29 23:06:15 +00:00
David Carlier
1701589884 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-20601: ftp_connect() timeout argument overflow.
2025-11-29 23:05:37 +00:00
David Carlier
4312a446d0 Fix GH-20601: ftp_connect() timeout argument overflow.
close GH-20603
2025-11-29 23:05:14 +00:00
David Carlier
f900035b27 network: on freebsd using SO_REUSEPORT_LB for a better distribution.
SO_REUSEPORT on FreeBSD acts differently as the underlying semantic
is different (as it predates Linux) since it s more for UDP/multicasts.
The SO_REUSEPORT_LB flag, however, uses load balancing for group
of address:port combinations which is how Linux is implemented.

Co-authored-by: Jakub Zelenka <bukka@php.net>
2025-11-03 13:39:18 +01:00
Jakub Zelenka
aead67d0bb Add so_reuseaddr stream socket context option
This is to allow disabling of SO_REUSEADDR that is enabled by default.

To achieve better compatibility on Windows SO_EXCLUSIVEADDRUSE is set
if so_reuseaddr is false.

Closes GH-19967
2025-11-03 11:44:09 +01:00
Jakub Zelenka
d44eb76c91 Merge branch 'PHP-8.4' into PHP-8.5 2025-10-02 13:44:35 +02:00
Jakub Zelenka
10eb3d69c7 Merge branch 'PHP-8.3' into PHP-8.4 2025-10-02 13:43:47 +02:00
Jakub Zelenka
a3c14d6ab4 Do not use errno_t as it is not defined on musl (#20037) 2025-10-02 13:42:11 +02:00
Jakub Zelenka
879d5e9b88 Merge branch 'PHP-8.4' into PHP-8.5 2025-10-01 11:14:27 +02:00
Jakub Zelenka
152dfa8835 Merge branch 'PHP-8.3' into PHP-8.4 2025-10-01 11:12:42 +02:00
Jakub Zelenka
b7fdfb7147 Fix GH-19248: Use strerror_r instead of strerror in main
Or on Windows it is going to use either FormatMessageW or strerror_s
for compatibility with previous error messages.

It also needs to accomodate for GNU and BSD versions of strerror_r
returning different type.

Closes GH-19251
2025-10-01 11:12:08 +02:00
Gina Peter Banyard
dad28a30f3 main: pack _php_netstream_data_t and use bool instead of int type (#19331)
Fix use sites at the same time
2025-07-31 19:56:38 +01:00
Niels Dossche
4f233e3ba2 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix technically incorrect sizeof
2025-06-09 22:05:21 +02:00
Niels Dossche
fe3bea090e Fix technically incorrect sizeof
This doesn't actually matter because both `*sal` and `**sal` are pointer
sized, but this makes analysers happy.
Fixes bug #68866.

Closes GH-18816.
2025-06-09 22:05:09 +02:00
Jakub Zelenka
8d25978d65 Merge branch 'PHP-8.3' into PHP-8.4 2024-11-29 08:06:10 +01:00
Jakub Zelenka
6f05d96a2b Merge branch 'PHP-8.2' into PHP-8.3 2024-11-29 07:56:28 +01:00
Jakub Zelenka
69765d9220 Fix network connect poll interuption handling
When connecting to socket, it is possible to get EINTR. In such case,
there should be an another attempt to connect if we are not over the
timeout. The timeout should be adjusted accordingly in that case.

This fixes https://github.com/phpredis/phpredis/issues/1881

Closes GH-16606
2024-11-29 07:54:06 +01:00
Peter Kokot
888eb370cf Fix -Wundef/C4668 warnings (#15853)
- ZTS is either undefined or defined (to 1)
- PHP_WIN32 is either undefined or defined (to 1)
- HAVE_LIBEDIT is either undefined or defined (to 1)
2024-09-14 11:28:32 +02:00
Christoph M. Becker
edcd6cc564 gai_strerror() is not thread-safe on Windows (GH-15568)
First we refactor to have only a single usage of `PHP_GAI_STRERROR()`
left; then we drop the macro in favor of calling the different
functions conditionally in an ad-hoc style.

This is necessary because the return value of `php_win32_error_to_msg`
needs to be freed by the caller.

The error messages are no more inline with other error messages, since
`gai_strerror()` apparently always appends a period and a space.

We also properly configure IPv4/v6 on Windows.  Since WSPiApi.h has been
created in 2000, so we can safely assume that it is available everywhere
nowadays.  Furthermore, `gai_strerror()` is available regardless of
whether there is IPv6 support.
2024-09-08 16:16:40 +02:00
Niels Dossche
a092bcb4d7 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15565: --disable-ipv6 during compilation produces error EAI_SYSTEM not found
2024-08-24 14:16:40 +02:00
Niels Dossche
8da94cfc41 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15565: --disable-ipv6 during compilation produces error EAI_SYSTEM not found
2024-08-24 14:14:57 +02:00
Niels Dossche
4b6575a1f9 Fix GH-15565: --disable-ipv6 during compilation produces error EAI_SYSTEM not found
Closes GH-15567.
2024-08-24 14:14:20 +02:00
Gina Peter Banyard
35fbb0061d main/network: Use more appropriate types (#15511)
* main/network: Use more appropriate types

And check directly against 0 for success for functions not returning a zend_result

* Remove redundant declaration in file.h

Not sure why it even is here
2024-08-22 12:48:28 +01:00
Niels Dossche
32fe9bc430 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix uninitialized memory in network.c
2024-07-22 22:26:02 +02:00
Niels Dossche
40e0e92212 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix uninitialized memory in network.c
2024-07-22 22:25:53 +02:00
Niels Dossche
40551dd74b Fix uninitialized memory in network.c
See https://github.com/php/php-src/issues/14806#issuecomment-2208150509
and https://github.com/php/php-src/issues/14806#issuecomment-2208690481

Closes GH-15068.
2024-07-22 22:25:28 +02:00
Peter Kokot
84a0da1574 Sync #if/ifdef/defined (#14508)
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
2024-06-09 14:23:41 +02:00
Peter Kokot
2d66562e4b Sync HAVE_IPV6 and HAVE_GETADDRINFO in #if/ifdef/defined (#14341)
Follow up of GH-5526 (-Wundef)
2024-05-28 11:52:25 +02:00
Cristian Rodríguez
8e62e2b829 Mark multple functions as static (#13864)
* Mark many functions as static

Multiple functions are missing the static qualifier.

* remove unused struct sigactions

struct sigaction act, old_term, old_quit, old_int;
all unused.

* optimizer: minXOR and maxXOR are unused
2024-05-22 13:11:46 +02:00
Jorg Sowa
9c4beac8d3 Remove inet_aton
This removes the deprecated inet_aton and its Windows implementation.
The inet_aton can be replaced with platform agnostic inet_pton.

Closes GH-13479
2024-02-23 23:16:43 +01:00
Jorg Adam Sowa
e630aacf79 Remove HAVE_INET_PTON (#13410) 2024-02-21 00:43:56 +00:00
David CARLIER
931a8b0739 inet_ntop requirement check at configure time instead (#12700) 2023-11-17 16:01:46 +00:00
David Carlier
44f9c226aa following-up on GH-12551: removing inet_ntoa usage
Close GH-12554
2023-11-06 12:05:56 +00:00
David Carlier
4400eb270f Merge branch 'PHP-8.2' into PHP-8.3 2023-09-24 15:20:24 +01:00
David Carlier
4bfd3459fe Merge branch 'PHP-8.1' into PHP-8.2 2023-09-24 15:19:02 +01:00
David Carlier
d65c80031a Fix GH-12190: stream_context_create with address and port at 0.
Prior to the 8.1 rewrite, inet_aton was used for ipv4 addresses
therefore addresses like `0` passed.
For the bindto's case where both ip and port are set as such, we discard
the address binding.

Close GH-12195
2023-09-24 15:17:53 +01:00
Javier Eguiluz
732d92c0e5 [skip ci] Fix various typos and grammar issues (#11143) 2023-04-28 11:05:32 +02:00
Arnaud Le Blanc
246d13cd99 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  [ci skip] NEWS
  Return immediately when FD_SETSIZE is exceeded (#9602)
2022-10-01 11:24:23 +02:00
Arnaud Le Blanc
d4b99542d5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  [ci skip] NEWS
  Return immediately when FD_SETSIZE is exceeded (#9602)
2022-10-01 11:23:34 +02:00
Arnaud Le Blanc
80232de0e4 Return immediately when FD_SETSIZE is exceeded (#9602) 2022-10-01 11:20:43 +02:00
Christoph M. Becker
81d1a1b47b Update bug tracker links
The new php-src bugtracker is on Github.

Closes GH-8277.
2022-05-12 14:55:11 +02:00
Arnaud Le Blanc
9e74e58bcf Fix whitespaces 2022-04-29 23:37:57 +02:00
Cristian Rodríguez
be04769c9a main: set IP_BIND_ADDRESS_NO_PORT if available when connecting to remote host
When you choose to bind() to a local address and connect to a remote host
the kernel does not know if socket is listener or whatnot and has to reserve
a port within a ~32k range on which you are also competing with other
applications bound to the same address, this is easy to exhaust and get a
EADDRINUSE.
The linux kernel implemented IP_BIND_ADDRESS_NO_PORT on
90c337da15
which delays the port allocation until the 4-tuple is known in case source port
is 0.
2022-04-29 23:36:10 +02:00
Kamil Tekiela
c3dda473cc Fix 'can not' in test data and in code comments 2021-10-05 09:51:58 +01:00