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

445 Commits

Author SHA1 Message Date
Petr Sumbera
ce1cadba29 Fix Solaris tests and add nightly CI job
Closes GH-20709
2026-03-04 10:12:03 +01:00
David Carlier
b3c259c13c Revert "ext/posix: validate permissions argument in posix_mkfifo()"
This reverts commit 6bd97e72b7.
2026-02-16 17:49:37 +00:00
arshidkv12
6bd97e72b7 ext/posix: validate permissions argument in posix_mkfifo()
close GH-21102
2026-02-06 12:51:18 +00:00
arshidkv12
fdaa488144 ext/posix: validity check for flags argument in posix_access
close GH-21104
2026-02-06 05:51:28 +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
fd1e73078c Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/posix: (Further) fix groups array creation on macos.
2025-12-22 12:55:16 +00:00
David Carlier
250fd02851 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/posix: (Further) fix groups array creation on macos.
2025-12-22 12:54:36 +00:00
David Carlier
e63dae2941 ext/posix: (Further) fix groups array creation on macos.
With macos Tahoe and clang "17.0.0" (Xcode) the ext/posix/tests/posix_getgrgid_macosx.phpt test crashes as follow:

ext/posix/posix.c:681:19: runtime error: load of misaligned address 0x60800000e972 for type 'char **', which requires 8 byte alignment
0x60800000e972: note: pointer points here
70 00  2a 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00
seems memcpy had been translated to a load instruction ?
anyhow, we force to copy a "proper" char * source.

close GH-20744
2025-12-22 12:53:53 +00:00
DubbleClick
2b8d8ba7c4 Fix cross-compilation for musl C library
This adds a PHP_C_STANDARD_LIBRARY Autoconf macro to detect glibc/musl
more accurately and fixes "cross-compilation" with musl-libc on glibc
systems.

Co-authored-by: Peter Kokot <peterkokot@gmail.com>

Closes GH-19352
2025-10-03 00:58:44 +02:00
David CARLIER
d801a4634f Fixed GH-19381: posix_kill_pidoverflow test depends on pcntl too. (#19382) 2025-08-05 20:03:21 +01:00
David Carlier
f72105be81 ext/posix: value ranges check for posix_setrlimit and posix_setpgid
setpgid accepts values from 0 to "PID_MAX".
for setrlimit the culprit is using zend_long to represent rlim_t
but at least we accept -1 for RLIM_INFINITY, however rl_cur should
not be greater than rl_max value.

close GH-19281
2025-07-29 13:10:26 +01:00
David Carlier
3b4f2b0798 ext/posix: posix_kill() process_id range check.
pid_t is, for the most part, represented by a signed int, by overflowing
it, we end up being in the -1 case which affect all accessible processes.

close GH-18944
2025-07-28 15:31:14 +01:00
Peter Kokot
d154c7253e Autoconf: Move getlogin check for HAVE_GETLOGIN to ext/posix (#19058)
This check is related only to ext/posix so it's more clear to have it
defined when ext/posix is enabled.
2025-07-07 17:43:36 +02:00
Gina Peter Banyard
c26105d22e ext/posix: Remove ZPP tests 2025-06-23 14:30:08 +02:00
Niels Dossche
af87ade8b8 Cleanup php_posix_group_to_array() (#18497)
This function can be static, and the error checks are pointless:
1. It's guaranteed that the return value is an array by now,
   as it is always preceded by array_init(return_value).
2. The null check for g is pointless as every callee already
   handles that in a better way.
2025-05-04 20:07:14 +02:00
Niels Dossche
1fa076e187 Cleanup php_posix_passwd_to_array() (#18496)
This function can be static, and the error checks are pointless:
1. It's guaranteed that the return value is an array by now, as it is
   always preceded by array_init(return_value).
2. The null check for pw is pointless as every callee already handles
   that in a better way.
2025-05-04 20:07:06 +02:00
David CARLIER
b385e0dd2b ext/posix: preallocate arrays and/or change to packed ones. (#18370) 2025-04-20 23:23:43 +01:00
Calvin Buckley
34275564f2 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix FD getting code on big endian (#17259)
2024-12-30 12:42:24 -04:00
Calvin Buckley
b4d3e4e541 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix FD getting code on big endian (#17259)
2024-12-30 12:41:58 -04:00
Calvin Buckley
7c9f645393 Fix FD getting code on big endian (#17259)
* Fix FD getting code on big endian (PHP 8.3)

stream casting as FD returns a php_socket_t, which is an int, but
zend_long is 64-bit (on those platforms). This works on LE by
accidental (unless it forgets to clear the high word), but is fatal
on big endian.

* change cast to match sig
2024-12-30 12:40:32 -04:00
David Carlier
fb2443ac5c ext/posix posix_ttyname/posix_isatty fd error handling update.
Set to `EBADF` errno for posix_ttyname when out of ranges.
posix_fpathconf now returns false on out of range file descriptors.

close GH-17209
2024-12-19 13:24:07 +00:00
David Carlier
ca5fd05536 ext/posix: adding POSIX_SC_OPEN_MAX constant.
returns the number of file descriptors that a process can handle.
e.g. useful after pcntl_fork() to close all the file descriptors up
to that boundary.

close GH-16681
2024-11-02 14:28:07 +00:00
Ilija Tovilo
b7e39970d3 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [skip ci] Mark some more macOS tests as flaky
2024-10-13 02:07:19 +02:00
Ilija Tovilo
5c8f42f05c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Mark some more macOS tests as flaky
2024-10-13 02:07:11 +02:00
Ilija Tovilo
b6ca871396 [skip ci] Mark some more macOS tests as flaky 2024-10-13 02:06:57 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
e7c4d54d65 Use new helper function for "cannot be empty" ValueErrors 2024-08-21 21:12:17 +01:00
Peter Kokot
c69d29ebc3 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15515: Configure error grep illegal option q (#15516)
2024-08-21 15:57:33 +02:00
Peter Kokot
9e63e20a2c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15515: Configure error grep illegal option q (#15516)
2024-08-21 15:54:56 +02:00
Peter Kokot
16d9bd0aae Sync AC_DEFINE help texts (#15207) 2024-08-03 09:47:39 +02:00
Peter Kokot
f66feaec0f Sync HAVE_<extension> help texts (#15167)
This syncs all help texts of extension preprocessor macros to the same
style "Define to 1 if the PHP extension '<ext>' is available.".
[skip ci]
2024-08-02 01:41:47 +02:00
Peter Kokot
1ceadaed52 Autotools: Normalize and quote all PHP_NEW_EXTENSION arguments (#15144)
This adds Autoconf quote characters to all PHP_NEW_EXTENSION arguments
and syncs the CS across the php-src Autotools build system.
2024-07-29 00:14:59 +02:00
Peter Kokot
2041c133ac Normalize AC_CHECK_FUNC* first argument (#14700)
The m4_normalize is for Autoconf < 2.70 (on 2.70 and later versions a
blank-or-newline separated items can be expanded without using
backslash-newline).

This also syncs the 1st argument quotes.
2024-06-28 22:40:24 +02:00
Arnaud Le Blanc
11accb5cdf Preferably include from build dir (#13516)
* Include from build dir first

This fixes out of tree builds by ensuring that configure artifacts are included
from the build dir.

Before, out of tree builds would preferably include files from the src dir, as
the include path was defined as follows (ignoring includes from ext/ and sapi/) :

    -I$(top_builddir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/main
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM
    -I$(top_builddir)/

As a result, an out of tree build would include configure artifacts such as
`main/php_config.h` from the src dir.

After this change, the include path is defined as follows:

    -I$(top_builddir)/main
    -I$(top_builddir)
    -I$(top_srcdir)/main
    -I$(top_srcdir)
    -I$(top_builddir)/TSRM
    -I$(top_builddir)/Zend
    -I$(top_srcdir)/Zend
    -I$(top_srcdir)/TSRM

* Fix extension include path for out of tree builds

* Include config.h with the brackets form

`#include "config.h"` searches in the directory containing the including-file
before any other include path. This can include the wrong config.h when building
out of tree and a config.h exists in the source tree.

Using `#include <config.h>` uses exclusively the include path, and gives
priority to the build dir.
2024-06-26 00:26:43 +02:00
Peter Kokot
8112889a73 Wrap ttyname_r check in AC_CACHE_CHECK (#14417)
This enables cross-compiling to set the php_cv_func_ttyname_r variable
for adjusting the configuration manually.

In case of cross-compiling the AC_CHECK_FUNCS is additionally used to
guess whether the target has the ttyname_r. Current platforms mostly
either have working ttyname_r compatible with POSIX or not.
2024-06-01 22:42:22 +02:00
Gina Peter Banyard
25a5146180 Clean-up unused headers (#14365)
* ext/mbstring.c: clean-up headers and include intrinsics
2024-06-01 17:12:42 +01:00
Arnaud Le Blanc
af5db45dc9 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  fix: zend-max-execution-timers with negative or high timeout value (#13942)
  Use return value of getpwuid_r(), not errno (#13969)
2024-04-16 14:20:23 +02:00
Arnaud Le Blanc
c12fd0873b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  fix: zend-max-execution-timers with negative or high timeout value (#13942)
  Use return value of getpwuid_r(), not errno (#13969)
2024-04-16 14:19:35 +02:00
Arnaud Le Blanc
32efc76c32 Use return value of getpwuid_r(), not errno (#13969) 2024-04-16 14:08:28 +02:00
David CARLIER
26c432d850 ext/posix: changing helpers return to zend_result. (#13957) 2024-04-13 22:04:55 +01:00
Arnaud Le Blanc
47f0a06d34 Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS
  [ci skip] NEWS
  Fix usage of reentrant functions in ext/posix (#13921)
2024-04-11 13:32:17 +02:00
Arnaud Le Blanc
d986b5c66d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix usage of reentrant functions in ext/posix (#13921)
2024-04-11 13:29:49 +02:00
Arnaud Le Blanc
66809c05b7 Fix usage of reentrant functions in ext/posix (#13921)
- It's not necessarily an error of sysconf(_SC_GETPW_R_SIZE_MAX) returns -1, as
  specified by posix (and the musl implementation always returns -1). Pick an
  initial buffer size in this case.
- Reentrant variants return an error number an may not set errno
- Implement retry logic for ttyname_r()
- Fix retry logic for getpwnam_r() (pw would be NULL after the first try)
- Test retry logic by setting the initial buffer size to 1 in debug builds
2024-04-11 13:27:39 +02:00
David Carlier
db2869346c ext/posix: posix_isatty set errno for it too.
Close GH-13918
2024-04-09 17:34:03 +01:00
Peter Kokot
c6f4c26e1b Check major, minor and makedev with Autoconf's AC_HEADER_MAJOR (#13706)
The non-standard major(), minor(), and makedev() can be defined as
macros. These are usually used together with the Autoconf macro
AC_HEADER_MAJOR, which defines the MAJOR_IN_MKDEV if sys/mkdev.h is
available, or MAJOR_IN_SYSMACROS if sys/sysmacros.h is available.

On Solaris/illumos they are in the sys/mkdev.h header (macro defined to
libc implementation) and in sys/sysmacros.h (macro defined with binary
operators and bits shifting). On systems with musl and glibc 2.28 or
later they are defined in sys/sysmacros.h, in glibc 2.27 and earlier
they were in sys/types.h. On BSD-based systems and macOS they are in the
sys/types.h.

Autoconf 2.70 has fixed the AC_HEADER_MAJOR macro, so it detects the
headers properly due to glibc 2.25 throwing deprecation warnings when
using the macros from sys/types.h. With Autoconf 2.69 and earlier the
ac_cv_header_sys_types_h_makedev cache variable can skip the
improper sys/types.h check in the macro.

This change syncs the usage within the ext/fileinfo/libmagic bundled
library and ext/posix.

When sys/mkdev.h header is available, code includes that, otherwise
it conditionally includes the sys/sysmacros.h. The ext/posix has
additional check whether linker sees the makedev, otherwise it checks
if makedev is declared within the given set of headers accoring to the
AC_HEADER_MAJOR logic. Previously the AC_CHECK_FUNCS didn't detect it.
2024-03-15 21:18:05 +01:00
Máté Kocsis
f2e199e878 Implement "support doc comments for internal classes and functions" (#13266)
Fixes #13130
2024-02-25 08:41:31 +01:00
Máté Kocsis
10957e498c Do not generate frameless info items when func info generation is disabled
While here, I fixed newlines around arginfo and function entry generation. Previously, newlines were repeated.
2024-02-18 11:39:00 +01:00
Peter Kokot
f9cfd40fa2 Refactor utsname.domainname struct member Autoconf check (#13336)
* Refactor utsname.domainname struct member Autoconf check

Autoconf's AC_CHECK_MEMBERS macro (available since Autoconf 2.50) can be
used instead of the compile check. This was originally implemented for
IRIX compatibility, when Autoconf 2.13 didn't have the struct members
checking macro yet.

Macro by default here defines the HAVE_STRUCT_UTSNAME_DOMAINNAME symbol.

* Remove also redundant DARWIN symbol check

Checking in the configuration step also correctly detects missing struct
member on Darwin systems (macos...).
2024-02-06 23:21:42 +01:00
Peter Kokot
fd7342f62f Fix _GNU_SOURCE redefined warnings in config.log
_GNU_SOURCE is already defined when doing these checks and warnings are
emitted otherwise in the configuration step.
2024-01-10 08:39:29 +01:00
Jakub Zelenka
594839b5fe Merge branch 'PHP-8.3' 2023-11-20 13:43:43 +00:00