Commit Graph

135324 Commits

Author SHA1 Message Date
Máté Kocsis
5bb03158b6
Add the last few remaining constants to stubs (#13751)
Basically all constants are now declared via stubs. The rest of the constants are either deprecated (`SID` or `MHASH_*`) or out of interest (`__COMPILER_HALT_OFFSET__` and `PHP_CLI_PROCESS_TITLE`).
2024-03-19 08:20:33 +01:00
David CARLIER
51dafc6054
Fix GH-13745: fix header inclusion in pdo_pgsql.c (#13749)
pdo/php_pdo_int.h is not part of the PDO's headers to install.
2024-03-18 23:07:41 +00:00
Máté Kocsis
5992a29724
Improve BC support of arginfo files fenerated by gen_stub.php (#13705)
- Declared compatibility expectations of stub files are now enforced by a ZEND_STATIC_ASSERT call at the top of arginfo files
- Property registration for PHP 7 is fixed: function zend_declare_property_ex() is used again instead of zend_declare_typed_property(). This has been a regression since I added support for exposing doc comments.
- As a defensive measure, deep cloning is performed before newer features (type declarations, attributes etc.) are discarded before generating legacy arginfo files. Until now, some of the objects were forgotten to be taken care of. These omissions may have resulted in some weird bugs in theory (but probably they didn't have much impact in practice).
- PHP version related conditions inside *non-legacy arginfo files* used to possibly check for the 70000 version iD until now if compatibility with PHP 7.0 was declared in a stub. This was not 100% correct, since non-legacy arginfo files are only for PHP 8.0+. Now, I made sure that at least PHP version ID 80000 is used in the preprocessor conditions. The solution was a bit tricky though...
2024-03-18 22:06:17 +01:00
Bob Weinand
4e934d789e Merge branch 'PHP-8.3' 2024-03-18 20:26:24 +01:00
Bob Weinand
50fe64c345 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 20:26:00 +01:00
Bob Weinand
059bf33e60
Properly forward the signal to the original handler if TSRM is shutdown. (#10219)
This ensures proper handling of SIGQUIT in ZTS fpm builds outside of active requests.
2024-03-18 20:24:23 +01:00
Dmitry Stogov
968a807d97 Update IR
IR commit: 84df6f8d409c7d06daa68d96a25d0aed81dcbf4a
2024-03-18 21:47:06 +03:00
Bob Weinand
9bed0b5f2f Merge branch 'PHP-8.3' 2024-03-18 19:06:12 +01:00
Bob Weinand
6d6cd29909 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 19:04:12 +01:00
Bob Weinand
10d912d6e3
Fix GH-13712: Segmentation fault for enabled observers when calling trait method of internal trait when opcache is loaded (#13735)
Inherited methods regardless of source must share the original runtime cache. Traits were missed.
This adds ZEND_ACC_TRAIT_CLONE to internal functions as well to allow easy distinction of these.
2024-03-18 19:02:42 +01:00
Niels Dossche
f47b7f1c70
Cleanup name handling in magic methods (#13733)
The copy was introduced in bc59289b7, and later changed in 57527455eb,
to prevent indirect modifications of magic method arguments.
This is no longer necessary because we no longer deal with zvals, but
with string directly that the VM has retrieved either as a constant, or
via zval_try_get_tmp_string().
2024-03-18 17:48:12 +01:00
Marc Bennewitz
805326fe18
An uninitialized DateTime is UNEXPECTED (#13492) 2024-03-18 16:38:30 +00:00
Bob Weinand
d539c4b8f6 Merge branch 'PHP-8.3' 2024-03-18 17:22:48 +01:00
Bob Weinand
35aef8ee87 Merge branch 'PHP-8.2' of https://github.com/php/php-src into PHP-8.3 2024-03-18 17:22:23 +01:00
Bob Weinand
6fb8b9d721 Fix possible segfault with 0x0 shared opcache base
Moving the minimum base of the shared opcache memory to the second huge page to avoid a possible 0x0 base, which may cause all sorts of segfaults.
This is not a problem on most systems which have a mmap_min_addr which is non-zero, but e.g. WSL1 doesn't have a minimum mapping address.
2024-03-18 17:18:33 +01:00
Tim Düsterhus
81744d6cf7
random: Improve the output quality of RANDOM_SEED() (#13730)
* random: Improve the output quality of RANDOM_SEED()

Previously 4 consecutive calls to `RANDOM_SEED()` each for 4 different CLI
requests resulted in:

    $ sapi/cli/php test.php
    2c13e9fde9caa
    2c13e9fd1d6b0
    2c13e9fd4de34
    2c13e9fd1610e
    $ sapi/cli/php test.php
    2c1436764fe07
    2c14367621770
    2c143676c0bf6
    2c143676e02f5
    $ sapi/cli/php test.php
    2c144995a0626
    2c14499590fe2
    2c144995c65db
    2c14499536833
    $ sapi/cli/php test.php
    2c145cb30860b
    2c145cb3ec027
    2c145cb33b4ca
    2c145cb38ff63

Now they result in:

    $ sapi/cli/php test.php
    6796973ace1b5f3d
    1913daf5c158cb4b
    255dbf24237bc8c9
    7c3ba22e60f35196
    $ sapi/cli/php test.php
    afb7cc9ba9819cd2
    3e01a71b91ad020c
    6b718364d3ef108
    bdcd17beeb4b31d2
    $ sapi/cli/php test.php
    53d36eb9b83f8788
    4381c85e816187aa
    2e9b32ee9898e71e
    31d15c946842bddb
    $ sapi/cli/php test.php
    2037a3cba88114b4
    ba0b0d93a9bb43aa
    e13d82d2421269e2
    191de474f3292240

* tree-wide: Replace GENERATE_SEED() by php_random_generate_fallback_seed()

* random: Fix NTS build

* random: Fix Windows build
2024-03-18 16:08:23 +01:00
Peter Kokot
4f7a3d9053
Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests
2024-03-18 11:59:34 +01:00
Peter Kokot
f66696548b
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests
2024-03-18 11:58:56 +01:00
Michael Orlitzky
00799320ec
Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests
In commit 85e5635a, a feature test for the various libgd image formats
was added. That test however erroneously omits the GDLIB_CFLAGS (from
pkg-config) during compilation. This can lead to build failures and
therefore false negatives from the test.

Here, we add $GDLIB_CFLAGS to $CFLAGS for the duration of the test.

Closes GH-12019
2024-03-18 11:57:20 +01:00
David Carlier
952cc2a675 Merge branch 'PHP-8.3' 2024-03-18 06:59:29 +00:00
David Carlier
839153069f Merge branch 'PHP-8.2' into PHP-8.3 2024-03-18 06:58:14 +00:00
David Carlier
868257a3de Fix GH-13727: macro generating invalid call test prototypes fixes.
autoconf/libtool generating code to test features missed `void` for
C calls prototypes w/o arguments.
Note that specific changes related to libtool have to be upstreamed.

Co-authored-by: Peter Kokot <petk@php.net>

close GH-13732
2024-03-18 06:53:39 +00:00
Máté Kocsis
56cf09f23a
Improve optimizer support for class constants (#13438)
The following optimizations are added:

- Constant folding of final class constants
- Type inference of typed class constants
2024-03-18 07:30:44 +01:00
Peter Kokot
0aadc7e7ff
Fix string concatenation in ZEND_JIT_SRC variable (#13740)
The += operator only works in bash shells and when using /bin/sh, for
example in Alpine Linux, the warning is thrown during configuration step

./configure: line 51396: ZEND_JIT_SRC+= jit/ir/ir_disasm.c: not found
2024-03-18 06:58:30 +01:00
Gina Peter Banyard
a648365fc0
ext/spl: Throw TypeError when overloaded SplObjectStorage::getHash() method does not return a string 2024-03-17 23:08:58 +00:00
Gina Peter Banyard
610c7a07b1
Move SplObjectStorage test to a folder 2024-03-17 23:08:47 +00:00
David Carlier
4c467e6eb8 ext/sockets: adding few constants for NetBSD.
SOCK_CONN_DGRAM (and its alias SOCK_DCCP) for connection orientated
datagram.

Close GH-13728
2024-03-17 21:44:22 +00:00
Nikita Popov
67184f5445
Fix PdoSqlite::loadExtension() test (#13736)
The test contained a syntax error and an incorrect use of loadExtension(), which returns void not bool.

Also install the necessary package in CI, so it gets tested there.
2024-03-17 22:27:09 +01:00
Niels Dossche
47b6eabe37 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-13685: Unexpected null pointer in zend_string.h
2024-03-17 18:38:44 +01:00
Niels Dossche
dab5f8c15c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13685: Unexpected null pointer in zend_string.h
2024-03-17 18:38:36 +01:00
Niels Dossche
aa34e0acb4 Fix GH-13685: Unexpected null pointer in zend_string.h
Regressed in 6fbf81c.

There is a missing error check on spl_filesystem_file_read_line(), which
means that if the line could not be read (e.g. because we're at the end
of the file), it will not set intern->u.file.current_line, which will
cause a NULL pointer deref later on.

Fix it by adding a check, and reintroducing the silent flag partially to
be able to throw an exception like it did in the past.

Closes GH-13692.
2024-03-17 18:37:52 +01:00
Niels Dossche
b955973818 Only register error handling when observable
Closes GH-13702.
2024-03-17 18:24:40 +01:00
Niels Dossche
9fd74cfc9d Use temporary variables to reduce memory stores 2024-03-17 18:21:59 +01:00
Niels Dossche
cbc421e163 Add fast path for ASCII bytes in UTF-8 validation 2024-03-17 18:21:59 +01:00
Bob Weinand
6f49474542 Merge branch 'PHP-8.3' of https://github.com/php/php-src 2024-03-17 03:17:15 +01:00
Bob Weinand
6c4e3c0f52
Use ZEND_API in zend_hrtime (#13288)
This allows actually calling zend_hrtime() from extensions on Windows.

Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2024-03-17 03:09:08 +01:00
Arnaud Le Blanc
bf4311325c Skip new_oom.phpt if ZMM is disabled
Test requires ZMM
2024-03-16 15:56:33 +01:00
Máté Kocsis
b06c95b631
Declare the missing true return types (#13709) 2024-03-16 07:26:37 +01:00
Niels Dossche
fcdcfe924a Merge branch 'PHP-8.3'
* PHP-8.3:
  Add missing DOM dependency in config.m4 for ext/xsl
2024-03-15 22:56:49 +01:00
Niels Dossche
7d1637a48c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add missing DOM dependency in config.m4 for ext/xsl
2024-03-15 22:56:40 +01:00
Niels Dossche
afdabb1247 Add missing DOM dependency in config.m4 for ext/xsl
Closes GH-13715.
2024-03-15 22:56:25 +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
Peter Kokot
e1181a64d4
Remove HAVE_MYSQL (#13719)
The ext/pdo_mysql symbol has been once used together with the removed
ext/mysql extension and isn't defined on Windows neither used in the
code anymore.
2024-03-15 20:33:59 +01:00
Saki Takamachi
54ee85ba88
Merge branch 'PHP-8.3'
* PHP-8.3:
  Changed the test expected value of `mysqli::info` to `%s` (#13723)
2024-03-16 00:15:20 +09:00
Saki Takamachi
1f7df80b43
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Changed the test expected value of `mysqli::info` to `%s` (#13723)
2024-03-16 00:14:38 +09:00
Saki Takamachi
23eb6a00e2
Changed the test expected value of mysqli::info to %s (#13723)
Closes #13723
Fixes #13628
2024-03-16 00:14:18 +09:00
Peter Kokot
072e67fd01
Fix unused variable warning in sapi/litespeed (#13718) 2024-03-15 08:56:35 +01:00
Peter Kokot
d2eb3e54ea
Check asm goto support with AC_LINK_IFELSE (#13716)
The '__asm__ goto' support is properly recognized by a simpler linking
check instead of a run check for easier cross-compilation. The
compile only check (AC_COMPILE_IFELSE) might produce false positives
results with certain compiler options.
2024-03-15 06:44:27 +01:00
Peter Kokot
ec394cc26a
Fix implicitly marking parameter as nullable deprecation warning (#13714)
A follow up around the php-src code regarding the RFC:
https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
2024-03-14 21:51:55 +01:00
Niels Dossche
2b77e5bc6b Fix compile warning 2024-03-14 21:22:03 +01:00