Commit Graph

819 Commits

Author SHA1 Message Date
David Carlier
fc147ed8db
sockets exposing TC_DEFER_ACCEPT to optimise tcp exchanges. 2021-06-09 06:54:02 +02:00
David Carlier
95a9e558b6
Pull #6989 FreeBSD defines SO_ACCEPTFILTER 2021-05-31 11:40:20 +02:00
Nikita Popov
7bc8f2c83f Skip unsupported socket option test on FreeBSD 2021-05-19 09:48:22 +02:00
Nikita Popov
b9fbbcc867 Use different error condition in socket test
The previously used error does not occur on FreeBSD and instead
causes the operation to time out.

Also clean up the test a bit. And make sure it actually tests
something -- the point is that socket_last_error() should be 0
after socket_clear_error(). It's kind of pointless if the test
uses a wildcard for the final result instead.
2021-05-19 09:48:17 +02:00
Nikita Popov
79c9028ca6 Relax error message expectation in socket test 2021-05-18 19:34:34 +02:00
Nikita Popov
4baf340c39 Merge branch 'PHP-8.0'
* PHP-8.0:
  Remove getservbyname() variation tests
  Use SOL_TCP instead of getprotobyname() in tests
2021-05-07 14:56:13 +02:00
Nikita Popov
0413cf3c20 Use SOL_TCP instead of getprotobyname() in tests
This is more idiomatic anyway, and works on msan, which misses
interceptors for getprotobyname().
2021-05-07 14:55:18 +02:00
Remi Collet
f9547f2b47
get rid of inet_aton and inet_ntoa use inet_ntop iand inet_pton where available standardize buffer size 2021-05-06 13:39:58 +02:00
KsaR
01b3fc03c3
Update http->https in license (#6945)
1. Update: http://www.php.net/license/3_01.txt to https, as there is anyway server header "Location:" to https.
2. Update few license 3.0 to 3.01 as 3.0 states "php 5.1.1, 4.1.1, and earlier".
3. In some license comments is "at through the world-wide-web" while most is without "at", so deleted.
4. fixed indentation in some files before |
2021-05-06 12:16:35 +02:00
Nikita Popov
ce0bc58c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Mark resource-like objects as non-comparable
2021-02-16 14:22:03 +01:00
Nikita Popov
b63ea1047a Mark resource-like objects as non-comparable
As these hold on to some internal resource, there can't be two
"equal" objects with different identity. Make sure the lack of
public properties doesn't result in these being treated as always
equal.
2021-02-16 14:20:45 +01:00
Máté Kocsis
bf0f6aaf18
Improve class entry generation
Related to GH-6701
2021-02-16 13:09:56 +01:00
Nikita Popov
1f04f162a6 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #80723
2021-02-16 12:34:00 +01:00
Nikita Popov
cb9785add1 Fixed bug #80723
This fixes the issue just for the Socket class. Presumably we'll
want to do the same for other "resource" objects.
2021-02-16 12:33:50 +01:00
Máté Kocsis
a730dc0cf9
Generate class entries for snmp, soap, sockets, sodium, sqlite3, sysv*, tidy
Closes GH-6696
2021-02-15 11:45:26 +01:00
Nikita Popov
b10416a652 Deprecate passing null to non-nullable arg of internal function
This deprecates passing null to non-nullable scale arguments of
internal functions, with the eventual goal of making the behavior
consistent with userland functions, where null is never accepted
for non-nullable arguments.

This change is expected to cause quite a lot of fallout. In most
cases, calling code should be adjusted to avoid passing null. In
some cases, PHP should be adjusted to make some function arguments
nullable. I have already fixed a number of functions before landing
this, but feel free to file a bug if you encounter a function that
doesn't accept null, but probably should. (The rule of thumb for
this to be applicable is that the function must have special behavior
for 0 or "", which is distinct from the natural behavior of the
parameter.)

RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg

Closes GH-6475.
2021-02-11 21:46:13 +01:00
Nikita Popov
3e01f5afb1 Replace zend_bool uses with bool
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.

Of course, zend_bool is retained as an alias.
2021-01-15 12:33:06 +01:00
Nikita Popov
422d1665a2 Make convert_to_*_ex simple aliases of convert_to_*
Historically, the _ex variants separated the zval first, if a
conversion was necessary. This distinction no longer makes sense
since PHP 7.

The only difference that was still left is that _ex checked whether
the type is the same first, but the usage of these macros did not
actually distinguish on whether such an inlined check is valuable
or not in a given context.

Also drop the unused convert_to_explicit_type macros.
2021-01-14 12:11:11 +01:00
Christoph M. Becker
1a0fa12753 Merge branch 'PHP-8.0'
* PHP-8.0:
  socket_create_pair() can no longer return NULL
2021-01-12 12:09:13 +01:00
Christoph M. Becker
41e9a8ebdc socket_create_pair() can no longer return NULL
Closes GH-6592.
2021-01-12 12:08:31 +01:00
Nikita Popov
a69da19c6b Merge branch 'PHP-8.0'
* PHP-8.0:
  Use ephemeral port in socket_create_listen_used.phpt
2021-01-12 10:09:38 +01:00
Nikita Popov
bc0f78a2da Use ephemeral port in socket_create_listen_used.phpt
Avoid parallelism issues.
2021-01-12 10:09:30 +01:00
Nikita Popov
90d5c40e25 Merge branch 'PHP-8.0'
* PHP-8.0:
  Use ephemeral ports in mcast_ipv*_recv.phpt
2020-11-30 09:50:05 +01:00
Nikita Popov
e77ac88a44 Use ephemeral ports in mcast_ipv*_recv.phpt 2020-11-30 09:49:39 +01:00
Nikita Popov
2b7d5eddfc Merge branch 'PHP-8.0'
* PHP-8.0:
  sockets: Fix variable/macro name collision on AIX
2020-11-25 11:55:05 +01:00
Calvin Buckley
e074e029ee sockets: Fix variable/macro name collision on AIX
The name "rem_size" is used by a macro in a system header on AIX,
specifically `sys/xmem.h`. Without changing the name, you get the
name mangled like so:

```
In file included from /usr/include/sys/uio.h:92:0,
                 from /QOpenSys/pkgs/lib/gcc/powerpc-ibm-aix6.1.0.0/6.3.0/include-fixed-7.1/sys/socket.h:83,
                 from /usr/include/sys/syslog.h:151,
                 from /usr/include/syslog.h:29,
                 from /home/calvin/rpmbuild/BUILD/php-8.0.0RC5/main/php_syslog.h:27,
                 from /home/calvin/rpmbuild/BUILD/php-8.0.0RC5/main/php.h:318,
                 from /home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:17:
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c: In function 'zif_socket_cmsg_space':
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:298:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
   size_t rem_size = ZEND_LONG_MAX - entry->size;
          ^
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:298:10: error: expected expression before '.' token
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:299:18: error: 'u2' undeclared (first use in this function)
   size_t n_max = rem_size / entry->var_el_size;
                  ^
/home/calvin/rpmbuild/BUILD/php-8.0.0RC5/ext/sockets/sendrecvmsg.c:299:18: note: each undeclared identifier is reported only once for each function it appears in
```

...because of the declaration in `sys/xmem.h`:

```
```

This just renames the variable so that it won't trip on this
definition. Tested to fix the build on IBM i PASE.

Closes GH-6453.
2020-11-25 11:54:40 +01:00
Christoph M. Becker
1e0610fe24 Merge branch 'PHP-8.0'
* PHP-8.0:
  Strip trailing line breaks and periods from Windows error messages
2020-11-12 16:43:57 +01:00
Christoph M. Becker
a08a2b48b4 Strip trailing line breaks and periods from Windows error messages
PHP error messages should not contain line breaks, so we remove these
from the Windows specific error messages.  We also remove trailing
periods for the same reason.

Closes GH-6423.
2020-11-12 16:42:28 +01:00
Nikita Popov
01de00073f Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix double free when socket_accept fails
2020-11-11 12:48:44 +01:00
Nikita Popov
800cf5a20f Fix double free when socket_accept fails 2020-11-11 12:48:25 +01:00
George Peter Banyard
150ebfdf77 Suppress bogus [-Wlogical-op] warning from GCC
See GCC bug 69602: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
which emits the warning for (errno == EWOULDBLOCK || errno == EAGAIN)
which is the correct way of handling errors as the value of EWOULDBLOCK
and EAGAIN is implementation defined.

Therefore introduce a new macro function PHP_IS_TRANSIENT_ERROR()
which handles the case when EWOULDBLOCK and EAGAIN are identical.

Thanks to @twose for the idea.
2020-10-10 14:45:20 +01:00
Nikita Popov
79484b4f8a Update ext/sockets parameter names
Also change $max_length to $length in a number of filesystem APIs,
where our usage was inconsistent.

Closes GH-6276.
2020-10-06 12:12:43 +02:00
George Peter Banyard
189751cbeb Promote notice to ValueError for invalid hint key 2020-09-28 16:24:04 +01:00
Máté Kocsis
e950ca13ea
Consolidate the usage of "either" and "one of" in error messages
Closes GH-6173
2020-09-20 19:41:47 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
c76910cd96
Display types in stubs more uniformly
In preparation for generating method signatures for the manual.

This change gets rid of bogus false|null return types, a few unnecessary trailing backslashes, and settles on using ? when possible for nullable types.
2020-09-16 21:19:36 +02:00
Máté Kocsis
9975986b7e
Improve error messages mentioning parameters instead of arguments
Closes GH-5999
2020-09-09 10:47:43 +02:00
Christoph M. Becker
95cf7a0358 Fix Windows build for shared ext/sockets
We can't use `PHPAPI` for extensions which may be built shared.  Thus,
we introduce `PHP_SOCKETS_API`.
2020-09-08 22:54:21 +02:00
Remi Collet
4c43806b61 add socket_ce and socket_import_file_descriptor in public API 2020-09-08 17:26:22 +02:00
Máté Kocsis
628db3f3b5
Fix UNKNOWN default values in various extensions
Closes GH-6075
2020-09-07 19:02:02 +02:00
Nikita Popov
eb17f996fb Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid socket path clash in test
2020-08-26 12:12:23 +02:00
Nikita Popov
0487bcfac7 Avoid socket path clash in test 2020-08-26 12:11:22 +02:00
Nikita Popov
dad25538f6 Don't check specific message in socket_shutdown.phpt 2020-08-10 15:58:54 +02:00
Nikita Popov
e4f5190942 Only test one error in socket_strerror() test
The messages differ by used libc and version, so let's not try to
do exhaustive testing here.
2020-08-10 15:58:38 +02:00
Máté Kocsis
7aacc705d0
Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Máté Kocsis
af80d8a14e
Add more argument types to stubs
Closes GH-5943
2020-08-07 12:35:30 +02:00
Nikita Popov
af64001dcb Normalize error message capitalization 2020-08-05 16:44:06 +02:00
Nikita Popov
25d849d40b Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix memory leak on socket_sendmsg() / socket_recvmsg() error
2020-08-05 16:42:55 +02:00
Nikita Popov
3b86be23e6 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix memory leak on socket_sendmsg() / socket_recvmsg() error
2020-08-05 16:42:13 +02:00
Nikita Popov
6a1bd57df5 Fix memory leak on socket_sendmsg() / socket_recvmsg() error 2020-08-05 16:41:40 +02:00