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

1060 Commits

Author SHA1 Message Date
Weilin Du
2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
David CARLIER
f830fa9948 Sockets refactoring 2026 (#21365)
ext/sockets: internal refactorings.

- remove redundant memsets and faster socket unix path copy.
- simplify php_open_listen_sock.
- use INADDR_ANY directly instead of resolving via gethostbyname.
- remove redundant memsets in conversions.
2026-03-07 14:09:49 +00:00
Petr Sumbera
ce1cadba29 Fix Solaris tests and add nightly CI job
Closes GH-20709
2026-03-04 10:12:03 +01:00
ndossche
0375697dab Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix merge for ext/sockets
2026-02-15 23:28:51 +01:00
ndossche
b6ca14799d Fix merge for ext/sockets 2026-02-15 23:28:45 +01:00
David Carlier
d01bc9abd1 Merge branch 'PHP-8.5'
* PHP-8.5:
  ext/sockets: socket_sendto() add max addr length control for AF_UNIX.
2026-02-15 21:55:06 +00:00
David Carlier
15163debc5 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/sockets: socket_sendto() add max addr length control for AF_UNIX.
2026-02-15 21:54:54 +00:00
David Carlier
b6495c189a ext/sockets: socket_sendto() add max addr length control for AF_UNIX.
we just mirror what is done for socket_connect()/AF_UNIX type.

close GH-21218
2026-02-15 21:54:19 +00:00
David Carlier
f037d49bb8 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21161: socket_set_option() crash with array 'addr' entry as null.
2026-02-09 19:27:40 +00:00
David Carlier
1ff5eb448a Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21161: socket_set_option() crash with array 'addr' entry as null.
2026-02-09 19:27:29 +00:00
David Carlier
19ee3e6697 Fix GH-21161: socket_set_option() crash with array 'addr' entry as null.
in the ipv6 address creation helper we need to use, for the error
message, the converted data rather than assuming the original
is a proper zend_string().

close GH-21166
2026-02-09 19:26:48 +00:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
David Carlier
44d6417bd7 ext/sockets: GH-20532 socket_addrinfo_lookup() sets EAI error code on resolution failures with a new optional argument.
close GH-20534
2026-01-20 20:58:52 +00:00
David CARLIER
9b719cd4a3 ext/sockets: socket_addrinfo_lookup() allows AF_UNSPEC for ai_family. (#20658)
while still filtering out IPC like addresses and so on.

close GH-20658
2026-01-15 19:24:56 +00:00
James Lucas
46e55dd97c ext/sockets: adding Linux's TCP_USER_TIMEOUT constant.
Set TCP_USER_TIMEOUT to cap (ms) how long TCP will wait for ACKs on in-flight data
before aborting the connection; prevents stuck/half-open sessions and
enables faster failover vs default retransmission timeouts.

Co-authored-by: David Carlier <devnexen@gmail.com>

close GH-20708
2025-12-19 07:38:10 +00:00
Jakub Zelenka
2d105afce7 socket: properly expose TCP keepalive constants (#20376)
This fixes missing constants on MacOS where TCP_KEEPALIVE,
TCP_KEEPINTVL and TCP_KEEPCNT are available. Currently only
TCP_KEEPALIVE is defined there.
2025-11-03 19:12:09 +01:00
Gina Peter Banyard
fd1c3660ca ext/sockets: socket_recvfrom() improve error message when port argument is missing 2025-10-13 13:44:19 +01:00
Gina Peter Banyard
4e562f49f3 ext/sockets: socket_recvfrom() add test for missing port argument error message 2025-10-13 13:44:19 +01:00
Tim Düsterhus
985d681501 tree-wide: Replace zval_is_true() by zend_is_true() (#20065)
* tree-wide: Replace `zval_is_true()` by `zend_is_true()`

The former is a direct alias of the latter which is much more often used.

* zend_operators: Remove `zval_is_true()`
2025-10-07 20:44:32 +02:00
Tim Düsterhus
70117e53b9 sockets: Use return true / return false for functions returning bool
Changes done with Coccinelle:

    @r1@
    identifier fn;
    typedef bool;
    symbol false;
    symbol true;
    @@

    bool fn ( ... )
    {
    <...
    return
    (
    - 0
    + false
    |
    - 1
    + true
    )
    ;
    ...>
    }

Coccinelle patch sourced from
torvalds/linux@46b5c9b856.
2025-09-24 18:51:40 +02:00
David Carlier
2a96af743e fix build warnings for Haiku.
especially linker warning about php binary having an executable stack.

cloe GH-19575
2025-09-06 14:06:10 +01:00
Gina Peter Banyard
1f131e3ae6 [skip ci] ext/sockets: remove tests that leak memory (#19408)
I don't understand what the purposes of theses tests are.
2025-08-07 21:50:04 +01:00
Gina Peter Banyard
841afdc486 streams: use type zend_result instead of type int 2025-08-04 15:30:57 +01:00
David CARLIER
068aaed196 ext/sockets: using accept4 wheneever possible for php_accept_connect helper (#19268)
Haiku now supports it as well now, so we can simplify the workflow a bit for those platforms.
2025-07-27 20:52:11 +01:00
David CARLIER
4a0ad9bd91 ext/sockets: cmsg data array elements using uint32_t type instead. (#19254) 2025-07-27 15:43:59 +01:00
Niels Dossche
d9602e4362 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS for GH-19162
  ext/socket: Remove incorrect zval_ptr_dtor
  ext/hash: Remove incorrect zval_ptr_dtor
2025-07-17 21:52:23 +02:00
Niels Dossche
d11099ae32 ext/socket: Remove incorrect zval_ptr_dtor 2025-07-17 21:50:35 +02:00
David Carlier
64852b44b5 ext/sockets: multicast on unsupported socket type error change.
From a mere warning to an exception.

close GH-19114
2025-07-15 13:05:13 +01:00
David CARLIER
46213f879a ext/sockets: socket_addrinfo_lookup narrowing down socket family check to AF_INET/AF_INET6 only. (#19040) 2025-07-12 15:48:25 +01:00
Peter Kokot
c2af281c0c Use <winsock2.h> instead of legacy <winsock.h> (#19037)
This also omits defining unused HAVE_WINSOCK_H macro when building
ext/sockets.
2025-07-07 09:40:03 +02:00
Gina Peter Banyard
40be5fa99f ext/sockets: Remove bool type coercions in tests 2025-06-23 14:56:53 +02:00
DanielEScherzer
ddd33fd7e4 Generated arginfo headers: combine preprocessor conditional blocks (2) (#18667)
When global constants' or class constants' availability is based on some
preprocessor condition, the generated arginfo header files wrap the
declarations in the preprocessor `#if` conditional blocks, one per declaration,
even if they are in the same conditional block based on comments in the stub
file. Instead of having multiple conditional blocks one after the other with
the same condition, combine them into a single conditional block.
2025-06-22 14:35:28 -07:00
Gina Peter Banyard
279983dc8d ext/sockets: Use zval_is_true() instead of converting to boolean (#18681) 2025-05-28 20:06:47 +01:00
David CARLIER
c789e9c9f1 ext/sockets: socket_create_pair() simplify workflow. (#18679)
create the pair objects only on success.
2025-05-28 12:41:48 +01:00
David Carlier
5a7920ba60 ext/sockets: socket_shutdown() having proper constants for mode.
close GH-18648
2025-05-26 18:48:21 +01:00
David Carlier
dfff6ac852 Merge branch 'PHP-8.4' 2025-05-22 20:47:36 +01:00
David Carlier
c00d7e056a Merge branch 'PHP-8.3' into PHP-8.4 2025-05-22 20:47:25 +01:00
David Carlier
c30bddc18f Fix GH-18617: socket_import_file_descriptor return check.
to_zval_read_fd_array() helper when retrieving the socket protocol did
not check it.

close GH-18617
2025-05-22 20:46:18 +01:00
David Carlier
4671f8510c ext/sockets: UDP_SEGMENT support.
UDP segmentation offload is an optimisation attempt by sending multiple
large enough datagrams over UDP which reduces syscalls as by default,
they have to be broke down in small UDP packets, it is better if the
hardware supports it, other handed down to the software implementation.

close GH-18213
2025-05-22 20:32:29 +01:00
David CARLIER
68d54030a1 ext/sockets: using array optimisations. (#18367)
mostly explicit packed arrays.
2025-04-20 19:34:11 +01:00
Gina Peter Banyard
556e4d9008 streams: Indicate which argument fails the stream ZPP check 2025-03-24 22:54:34 +00:00
David CARLIER
21fd08be71 ext/sockets: adding SO_BUSY_POLL socket option for Linux. (#17954)
To possibly reduce the latency when polling packets by activating it
from the network interface for N microseconds.
The kernel by doing so, increase the CPU(s) activity bound to
the socket significantly.
Note that not only the kernel needs to have support enabled for it
(which the average distribution usually does) but the network
interface itself needs to support it too. If not, it is just a no-op.
2025-03-11 20:03:28 +00:00
David Carlier
d6cd754121 Merge branch 'PHP-8.4' 2025-02-25 21:56:01 +00:00
David Carlier
c8bead8393 Merge branch 'PHP-8.3' into PHP-8.4 2025-02-25 21:55:46 +00:00
David Carlier
8cbc0c57b7 Fix GH-17921 socket_read/socket_recv overflows on buffer size.
update the existing checks to be more straightforward instead of
counting on undefined behavior.

close GH-17923
2025-02-25 21:54:24 +00:00
David CARLIER
cc116067b2 Revert "ext/sockets: follow-up on AF_PACKET support." (#17924)
This reverts commit de018aa2c5.
2025-02-25 07:04:40 +00:00
David Carlier
de018aa2c5 ext/sockets: follow-up on AF_PACKET support.
support from socket_recvfrom and exposing basic PHP userland type.

close GH-17657
2025-02-24 22:09:29 +00:00
David CARLIER
0ec6413562 ext/sockets: multicast socket option helper change to zval_try_get_tmp_string() (#17871) 2025-02-20 23:47:33 +00:00
David CARLIER
6c096bfa13 ext/sockets: php_set_inet*_addr using zend_string instead. (#17845) 2025-02-20 21:59:55 +00:00
David Carlier
ddd1dd0c4b ext/sockets: adding BSD IP_BINDANY constant.
Simply allows the socket to bind to any address, including one not
bound to any network interface.

close GH-17591
2025-02-11 13:10:42 +00:00