Commit Graph

241 Commits

Author SHA1 Message Date
Christoph M. Becker
34ede22fd8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix possibly unsupported timercmp() usage
2020-06-09 16:56:35 +02:00
Christoph M. Becker
3c12c41927 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix possibly unsupported timercmp() usage
2020-06-09 16:54:43 +02:00
Christoph M. Becker
7ac0fb5ae4 Fix possibly unsupported timercmp() usage
The `timercmp()` manpage[1] points out that some systems have a broken
implementation which does not support `>=`.  This is definitely the
case for the Windows SDK, which only supports `<` and `>`.

[1] <https://linux.die.net/man/3/timercmp>
2020-06-09 16:52:19 +02:00
twosee
88355dd338 Constify char * arguments of APIs
Closes GH-5676.
2020-06-08 10:38:45 +02:00
Christoph M. Becker
f078bca729 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78210: Invalid pointer address
2020-03-11 11:32:46 +01:00
Christoph M. Becker
8657f03084 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #78210: Invalid pointer address
2020-03-11 11:31:26 +01:00
Christoph M. Becker
53797c206a Fix #78210: Invalid pointer address
This is actually about three distinct issues:

* If an empty string is passed as $address to `stream_socket_sendto()`,
  the `sa` is not initialized, so we must not pass it as `addr` to
  `php_stream_xport_sendto()`.

* On POSIX, `recvfrom()` truncates messages which are too long to fit
  into the specified buffer (unless `MSG_PEEK` is given), discards the
  excessive bytes, and returns the buffer length.  On Windows, the same
  happens, but `recvfrom()` returns `SOCKET_ERROR` with the error code
  `WSAEMSGSIZE`.  We have to catch this for best POSIX compatibility.

* In `php_network_parse_network_address_with_port()`, we have to zero
  `in6` (not only its alias `sa`) to properly support IPv6.

Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
2020-03-11 11:30:15 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
0b4778c377
Fix #78880: Another bunch of spelling errors 2020-01-16 09:46:47 +01:00
Christoph M. Becker
388c582ee9 Clarify usage of max_fd in php_poll2() on Windows
Actually, `max_fd` is not used on Windows, since `PHP_SAFE_MAX_FD` and
`select` ignore it; so it makes no sense to calculate it in the loop.
Even worse, since `php_socket_t` is unsigned on Windows, it will never
be modified during the loop, because `SOCK_ERR` is already the largest
representable value of that type.

Therefore we skip the loop on Windows, and add a clarifying comment.
2019-12-27 13:41:29 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
ca8f563f99 Merge branch 'PHP-7.3' into PHP-7.4 2019-04-15 15:00:56 +02:00
Nikita Popov
e05c6a25f9 Merge branch 'PHP-7.2' into PHP-7.3 2019-04-15 15:00:49 +02:00
Nikita Popov
9b1950b005 Zero sockaddr struct
in6 has a bunch of extra fields that we're leaving uninitialized. I
don't see them locally, but there's valgrind warnings on gcov.
2019-04-15 14:59:05 +02:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Zeev Suraski
0cf7de1c70 Remove yearly range from copyright notice 2019-01-30 11:03:12 +02:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Anatol Belski
321c0cc349 Fix localized error messages and memory leaks
The FormatMessage API needs to LocalFree the delivered error messages.
In cases where messages are delivered in non ASCII compatible encoding,
the messages might be unreadable. This aligns the error message encoding
with the encoding settings in PHP, the focus is UTF-8 as default.

Initialize error buffer

Avoid code duplication
2018-09-17 10:56:50 +02:00
Joe Watkins
6b5e7e6b42
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fix bug #74764 and add a test case
2018-09-04 11:13:14 +02:00
Joe Watkins
21f8cd2a92
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #74764 and add a test case
2018-09-04 11:12:39 +02:00
Ville Hukkamaki
0f724453c0
Fix bug #74764 and add a test case 2018-09-04 11:12:04 +02:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
seliver
95013042bf Fixed bug #76136 (stream_socket_get_name enclosed IPv6 in brackets)
The IPv6 IP of a socket is provided by inet_ntop() as a string, but
this function doesn't enclose the IP in brackets. This patch adds
them in the php_network_populate_name_from_sockaddr() function.
2018-07-07 11:47:50 +02:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Kalle Sommer Nielsen
d3bc8beb4f Removed support for BeOS, development for BeOS was supported 17 years ago.
This patch however does not drop support for the BeOS compatible variant, Haiku, see Github PR #2697 which is currently a WiP

I intentionally left out some fragments for BeOS in the build system for that seems to be bundles
2017-08-29 22:03:56 +02:00
Sara Golemon
e60cedfbc3 Merge branch 'PHP-7.1'
* PHP-7.1:
  Bugfix #74556 stream_socket_get_name() returns empty string
  Fix abstract name handling to be binary safe
2017-05-28 08:51:41 -07:00
Sara Golemon
e628ee9e9d Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Bugfix #74556 stream_socket_get_name() returns empty string
  Fix abstract name handling to be binary safe
2017-05-28 08:49:25 -07:00
Sara Golemon
6d2d0bbda7 Fix abstract name handling to be binary safe
Per unix(7):
abstract: an abstract socket address is distinguished (from a
pathname socket) by the fact that sun_path[0] is a null byte
('\0').  The socket's address in this namespace is given by the
additional bytes in sun_path that are covered by the specified
length of the address structure.  (Null bytes in the name have no
special significance.)  The name has no connection with filesystem
pathnames.  When the address of an abstract socket is returned,
the returned addrlen is greater than sizeof(sa_family_t) (i.e.,
greater than 2), and the name of the socket is contained in the
first (addrlen - sizeof(sa_family_t)) bytes of sun_path.

The existing implementation was assuming significance in null bytes
contained in the abstract address identifier.
2017-05-28 08:45:44 -07:00
Jakub Zelenka
2bce80150f Merge branch 'PHP-7.1' 2017-04-30 20:28:38 +01:00
Jakub Zelenka
9622a3be43 Merge branch 'PHP-7.0' into PHP-7.1 2017-04-30 20:27:39 +01:00
Michael Heimpold
d9dfac90bf Fix compiler warnings when compiled against musl libc
musl libc is complaining when <sys/poll.h> is used instead of <poll.h>
so change this.

This issue was reported for OpenWrt/LEDE where musl libc is the standard
C library instead of e.g. glibc, see the following link for the original PR:
https://github.com/openwrt/packages/pull/4263

Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: Michael Heimpold <mhei@heimpold.de>

--

v3: refined checks/fallback paths as suggested by @bukka

v2: rebased to resolve merge conflict in main/php_network.h

v1: initial PR
2017-04-30 20:24:56 +01:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
478f119ab9 Update copyright headers to 2017 2017-01-04 11:14:55 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Kalle Sommer Nielsen
2104bea5d7 Remove Netware support
If this does not break the Unix system somehow, I'll be amazed. This should get most of it out, apologies for any errors this may cause on non-Windows ends which I cannot test atm.
2016-11-12 11:20:01 +01:00
Xinchen Hui
3994a70b91 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72218 (If host name cannot be resolved then PHP 7 crashes)
  fix #72143 (preg_replace uses int instead of size_t on zend_string_allocs)
  fix #72206 (xml_parser_create/xml_parser_free leaks mem)
  improve 7132fe19c2
  fix 1bb8a7b0b8
  fix #72180 (Env variables incorrectly pretty printed in config.nice, phpinfo)

Conflicts:
	acinclude.m4
2016-05-16 11:21:39 +08:00
Xinchen Hui
1559fd7e48 Fixed bug #72218 (If host name cannot be resolved then PHP 7 crashes) 2016-05-16 11:19:45 +08:00
Joe Watkins
66fc5a3436 Implement #51879 stream context socket option tcp_nodelay 2016-04-29 12:11:58 +01:00
Joe Watkins
d9e4510224 remove unused params || woops 2016-03-31 12:51:00 +01:00
Joe Watkins
233115ea23 fix #71609: Segmentation fault on ZTS with gethostbyname 2016-03-31 12:39:01 +01:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Bob Weinand
855bb36fd0 Add support for IPV6_V6ONLY on sockets 2015-11-06 21:45:31 +01:00
Dmitry Stogov
7aa7627172 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 13:59:27 +03:00
Stanislav Malyshev
141b14454c Merge branch 'PHP-5.6'
* PHP-5.6:
  Use better constant since MAXHOSTNAMELEN may mean shorter name
  use right sizeof for memset

Conflicts:
	ext/sockets/sockaddr_conv.c
	ext/standard/dns.c
2015-01-31 21:50:08 -08:00
Stanislav Malyshev
af1f867308 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Use better constant since MAXHOSTNAMELEN may mean shorter name
  use right sizeof for memset
2015-01-31 21:48:14 -08:00