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

86 Commits

Author SHA1 Message Date
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
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
David CARLIER
4a0ad9bd91 ext/sockets: cmsg data array elements using uint32_t type instead. (#19254) 2025-07-27 15:43:59 +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
68d54030a1 ext/sockets: using array optimisations. (#18367)
mostly explicit packed arrays.
2025-04-20 19:34:11 +01: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
3e9b530d62 ext/sockets: conversions internal changes. (#17311)
following up on strlcpy removal work too.
2025-01-01 12:13:39 +00:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Peter Kokot
da86eec3db Sync #if/ifdef/defined (#14371)
These are either undefined or defined to value 1 in Autotools and
Windows:
- HAVE_COMMONCRYPTO_COMMONRANDOM_H
- HAVE_EXIF
- HAVE_FOPENCOOKIE
- HAVE_IF_NAMETOINDEX
- HAVE_LIBICONV
- HAVE_SOCKETS
- HAVE_STRUCT_STAT_ST_RDEV
- HAVE_STRUCT_TM_TM_GMTOFF
- HAVE_STRUCT_TM_TM_ZONE

Follow up of GH-5526 (-Wundef)
2024-06-07 23:45:17 +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
Peter Kokot
c1d6cf37e9 Check for struct cmsgcred with AC_CHECK_TYPES (#13507)
The AC_CHECK_TYPES can be used to check for the struct cmsgcred. By
default it defines the symbol HAVE_STRUCT_CMSGCRED instead of
ANC_CREDS_CMSGCRED.
2024-02-25 22:33:44 +01:00
Jorg Adam Sowa
e630aacf79 Remove HAVE_INET_PTON (#13410) 2024-02-21 00:43:56 +00:00
Niels Dossche
b606e44abc Silence compiler warnings in ext/sockets/conversions.c (#10974)
These values will be initialised, but the compiler can't see it.
Write a dummy value to silence this.

Closes GH-10959.
2023-03-29 22:18:29 +02:00
Niels Dossche
efdbb4715e Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix uninitialized variable accesses in sockets/conversions
2023-03-29 19:52:25 +02:00
Niels Dossche
8a1cbdd7df Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix uninitialized variable accesses in sockets/conversions
2023-03-29 19:47:38 +02:00
Niels Dossche
b8755a7559 Fix uninitialized variable accesses in sockets/conversions
This was first pointed out in GH-10959.
The from_zval_... functions don't always write to the pointer, in particular
it is necessary to check for an error before using the value. Otherwise
we can access an uninitialized value and that's UB (and dangerous).

Note: this does *NOT* get rid of the compiler warning. Even though there
is error checking now, the compiler isn't smart enough to figure out
that the values can not be used uninitialized.

Closes GH-10966.
2023-03-29 19:44:30 +02:00
Christoph M. Becker
c8955c078a Revert GH-10220
Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491.
This reverts commit 588a07f737.
This reverts commit f377e15751.
This reverts commit b4ba16fe18.
This reverts commit 694ec1deea.
This reverts commit 6b34de8eba.
This reverts commit aa1cd02a43.
This reverts commit 308fd311ea.
This reverts commit 16203b53e1.
This reverts commit 738fb5ca54.
This reverts commit 9fdbefacd3.
This reverts commit cd4a7c1d90.
This reverts commit 928685eba2.
This reverts commit 01e5ffc85c.
2023-01-16 12:27:33 +01:00
Max Kellermann
308fd311ea ext/{standard,json,random,...}: add missing includes 2023-01-10 14:19:03 +00:00
Ilija Tovilo
743d3780c6 Add clang ASAN/UBSAN push job
Closes GH-9507
2022-09-14 23:55:46 +02:00
David Carlier
6fe7ff95d9 Implements ancillary data on NetBSD.
With the couple LOCAL_CREDS/SCM_CREDS, in this system we get all the
infos needed (included the process id).
Closes GH-8700.
2022-06-06 23:06:01 +01:00
David CARLIER
f813520b50 Implements socket ancillary data on FreeBSD. (#7708)
using LOCAL_CREDS_PERSISTENT/SCM_CREDS2 instead so we also get the send process id.
2022-06-02 14:08:03 +01:00
Christoph M. Becker
f16d35cfe9 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix Solaris builds of ext/sockets
2022-03-10 14:51:30 +01:00
David Carlier
7eb972c456 Fix Solaris builds of ext/sockets
We enable the proper ancillary data handling layout and API.

Closes GH-7859.
2022-03-10 14:48:08 +01:00
Joe Watkins
00113b95b2 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  socket: ancillary credentials build fix for non linux systems.
2021-12-21 07:25:55 +01:00
David Carlier
51647eb23e socket: ancillary credentials build fix for non linux systems.
for systems using SO_PASSCRED sockopt flag but not using ucred struct.
2021-12-21 07:25:43 +01:00
Patrick Allaert
aff365871a Fixed some spaces used instead of tabs 2021-06-29 11:30:26 +02:00
Máté Kocsis
77172c220a Convert resources to objects in ext/sockets
Closes GH-5900.
2020-08-03 23:26:38 +02:00
Nikita Popov
501db98e57 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #79924
2020-08-03 14:56:57 +02:00
Nikita Popov
8b4da1774f Fix bug #79924
Move functions that are only used with ipv6 support under
HAVE_IPV6 checks.
2020-08-03 14:56:27 +02:00
George Peter Banyard
f91f72607b Drop unnecessary stdint and inttypes header checks
These are always available as of C99.

Closes GH-5323

Co-authored-by: "Christoph M. Becker" <cmbecker69@gmx.de>
2020-04-22 20:18:19 +02:00
George Peter Banyard
1589266f85 Remove dead code and unused DEFINEs
Closes GH-5073
2020-01-10 22:24:15 +01:00
George Peter Banyard
1c1de0c41a Convert all php_error_docref0 to php_error_docref
Closes GH-4394
2019-07-13 02:05:17 +02:00
George Peter Banyard
cfdca10910 Remove dead code in sockets extension [ci skip] 2019-06-15 08:39:35 +02:00
Nikita Popov
2134cc25d2 Guard functions by SO_PASSCRED 2019-06-12 13:17:25 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Nikita Popov
7f6c22cb3d Fix last maybe uninit warnings on 7.4
Most of these only occur under GCC 5. Not fond of all the workarounds
(especially the PDO one), but it gets us a clean build...
2019-04-15 11:35:13 +02:00
Dmitry Stogov
169d454593 Use zval_ptr_dtor() imstead of zval_dtor() 2018-07-05 17:55:54 +03:00
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Gabriel Caruso
a5f1a585e6 Removed unused variables 2018-02-11 22:46:33 +01:00
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00
Xinchen Hui
d56a534acc RC manipulation cleanup 2 2017-11-02 12:13:35 +08:00
Anatol Belski
afb6ca2566 Finish remaining replacement uint => uint32_t
Tthe core should be normalized now, no uints anymore
2016-12-22 14:32:02 +01:00
Anatol Belski
b204b3abd1 further normalizations, uint vs uint32_t
fix merge mistake

yet one more replacement run
2016-11-26 17:29:01 +01:00
Dmitry Stogov
adc95c5114 Fixed compilation warnings 2016-06-23 12:47:06 +03:00
Dmitry Stogov
1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Nikita Popov
42e32c33e2 More warning fixes 2015-07-17 21:12:15 +02:00
Dmitry Stogov
4a2e40bb86 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 04:05:24 +03:00