1
0
mirror of https://github.com/php/php-src.git synced 2026-04-23 07:58:20 +02:00
Commit Graph

14729 Commits

Author SHA1 Message Date
Ilija Tovilo 6ed730eb59 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix MSAN getservbyport() false positive
  Fix uninitialized CG(zend_lineno)
  Fix uninitialized EG(user_error_handler_error_reporting)
2024-09-09 19:35:09 +02:00
Ilija Tovilo a5bd4ccb8c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix MSAN getservbyport() false positive
  Fix uninitialized CG(zend_lineno)
  Fix uninitialized EG(user_error_handler_error_reporting)
2024-09-09 19:35:00 +02:00
Ilija Tovilo 0faa1d2017 Fix MSAN getservbyport() false positive
Closes GH-15814
2024-09-09 19:34:43 +02:00
Ilija Tovilo 24a294922b Fix uouv in array_column
column_long and index_long might not be set, but are still used as arguments.
They are not actually used if column_str is set, but it's better to initialize
them anyway, if only to make MemorySanitizer happy.
2024-09-09 16:55:02 +02:00
Christoph M. Becker 50b3a0d011 Add comments about internal headers (GH-15689)
A common convention is to name internal C header files as `*_int.h`.
Since a couple of these are actually installed, we add comments that
this is not supposed to happen, (a) to avoid installing further
internal headers, and (b) to pave the way to fix this in the next major
PHP version.

Somewhat special is php_gmp_int.h, where "int" is meant as abbreviation
for "interface".

Another common convention is appending `_priv` or `_private`, but since
there have not been any issues regarding these headers so far, we
refrain from adding respective comments to these headers.

Anyhow, it might be a good idea to introduce some common naming
convention for such internal/private headers.
2024-09-08 16:11:25 +02:00
DanielEScherzer 5dd0575698 Generated arginfo header files: combine preprocessor conditional blocks (#15736)
When functions' or class methods' availability is based on some preprocessor
condition, the generated arginfo header files wrap the declarations in the
preprocessor `#if` conditional blocks, one per declaration, even if they are in
the same conditional block based on comments in the stub file. Instead of
having multiple conditional blocks one after the other with the same condition,
combine them into a single conditional block.
2024-09-04 13:04:22 +02:00
Peter Kokot 13f041163c Remove Travis artefacts (#15714)
Travis was suspended https://github.com/php/php-src/pull/15314

This removes 404 errored Travis image in README, travis configuration
directory and YAML file and usages in tests.

[skip ci]

Co-authored-by: Gina Peter Banyard <girgias@php.net>
2024-09-04 01:15:10 +02:00
DanielEScherzer 53cb89670c Generated arginfo header files: remove empty zend_function_entry arrays (#15705)
When a class (or enum) has no methods, rather than using an array that only
contains `ZEND_FE_END`, use `NULL` for the functions. The implementation of
class registration for internal classes, `do_register_internal_class()` in
zend_API.c, already skips classes where the functions are `NULL`. By removing
these unneeded arrays, we can reduce the size of the header files, while also
removing an unneeded call to zend_register_functions() for each internal class
with no extra methods.
2024-09-03 23:19:53 +02:00
Christoph M. Becker 3892529fed Close-GH 15685: improve proc_open error reporting on Windows
While similar errors are already reported via `strerror()` on other
platforms, this has apparently overlooked for Windows, where only the
error code has been reported so far.

We adapt the affected test cases, but since there is no PHP userland
function which allows us to get the current system locale, we work
around.

Closes GH-15687.
2024-09-03 13:12:27 +02:00
Remi Collet 32c5ce3451 Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2 (#13635)
* Implement GH-13514 PASSWORD_ARGON2 from OpenSSL 3.2

* simplify init/shutdown

* use php_base64_encode_ex

* - rename macros - use openssl RAND_bytes - CS

* add --with-openssl-argon2 build option

* check OSSL_KDF_PARAM_ARGON2_LANES instead of OSSL_set_max_threads

* Cleanup and CS

* save/restore old threads config + CS

* remove unneeded check
2024-09-02 13:01:09 +02:00
Christoph M. Becker c013679b70 Merge branch 'PHP-8.3'
* PHP-8.3:
  Fix GH-15552: Signed integer overflow in ext/standard/scanf.c
2024-09-01 17:26:46 +02:00
Christoph M. Becker a51f54b54b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-15552: Signed integer overflow in ext/standard/scanf.c
2024-09-01 17:25:18 +02:00
Christoph M. Becker 08841bf79c Fix GH-15552: Signed integer overflow in ext/standard/scanf.c
We ensure that the argnum `value` is in the allowed range, *before*
mapping it to the `objIndex`, not *afterwards*.

Closes GH-15581.
2024-09-01 17:24:17 +02:00
Christoph M. Becker 0b1e401f2c Skip tests calling wmic if it is not available
The WMIC utitlity is deprecated as of Windows 10 21H1, and a feature on
demand which is enabled by default in Windows 11 22H2 and 23H2, but
will be disabled by default in the next release of Windows.[1]

Therefore, we ensure that tests which rely on wmic.exe are properly
skipped if it is not available.

[1] <https://learn.microsoft.com/en-us/windows/whats-new/deprecated-features#deprecated-features>

Closes GH-15583.
2024-09-01 17:19:37 +02:00
Christoph M. Becker ac4039df20 Mark gd14930.phpt as dynamic xfail
This test only fails when `NAME_MAX` is defined, which is never the
case on Windows, so we let the test pass there.  This could be extended
to other environments where `NAME_MAX` is not defined.
2024-09-01 15:04:54 +02:00
Go Kudo bf9929a26c standard: supress msan (#15665) 2024-08-31 15:56:11 +09:00
David Carlier fc01e2ee2b Merge branch 'PHP-8.3' 2024-08-30 17:17:44 +01:00
David Carlier d7d40b4c80 Merge branch 'PHP-8.2' into PHP-8.3 2024-08-30 17:17:20 +01:00
David Carlier 7db1a5843f Fix GH-15653: fgetcsv overflow on length parameter.
close GH-15655
2024-08-30 17:16:57 +01:00
Arnaud Le Blanc 58aa6fc830 Lazy objects
RFC: https://wiki.php.net/rfc/lazy-objects

Closes GH-15019
2024-08-30 17:30:03 +02:00
Peter Kokot 7e1e450bb9 Autotools: Remove redundant double quotes (#15634) 2024-08-29 15:17:03 +02:00
Ilija Tovilo 8df557ac42 [RFC] Asymmetric visibility v2 (GH-15063)
Co-authored-by: Larry Garfield <larry@garfieldtech.com>
2024-08-27 02:04:48 +02:00
Niels Dossche baac01f594 Improve virtual property error message
Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2024-08-26 21:17:49 +02:00
Kamil Tekiela c5bce0d8a2 Deprecate disabling use_only_cookies (#13578) 2024-08-24 16:33:45 +02:00
Máté Kocsis 8d12f666ae Fix registration of internal readonly child classes (#15459)
Currently, internal classes are registered with the following code:

INIT_CLASS_ENTRY(ce, "InternalClass", class_InternalClass_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
class_entry->ce_flags |= ...;

This has worked well so far, except if InternalClass is readonly. It is because some inheritance checks are run by zend_register_internal_class_ex before ZEND_ACC_READONLY_CLASS is added to ce_flags.

The issue is fixed by adding a zend_register_internal_class_with_flags() zend API function that stubs can use from now on. This function makes sure to add the flags before running any checks. Since the new API is not available in lower PHP versions, gen_stub.php has to keep support for the existing API for PHP 8.3 and below.
2024-08-24 12:36:54 +02:00
Peter Kokot 2e3132b3fd Autotools: Sync CS in ext/standard (#15560)
- Overquoted arguments reduced
- Added missing quotes in algorithms checks
- Synced indentations for algorithms checks
2024-08-23 22:30:09 +02:00
Jakub Zelenka 70c5e366f6 Revert fix for GH-14930: truncating readdir output (#15533) 2024-08-22 23:41:34 +01:00
Gina Peter Banyard 35fbb0061d main/network: Use more appropriate types (#15511)
* main/network: Use more appropriate types

And check directly against 0 for success for functions not returning a zend_result

* Remove redundant declaration in file.h

Not sure why it even is here
2024-08-22 12:48:28 +01:00
Gina Peter Bnayard 5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard 997199e938 ext/standard/string.c: use standard wording for ValueError in str_pad() 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard 10738141d7 ext/standard/exec.c: Use ZPP path modifier to check for nul bytes 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
Gina Peter Bnayard 9147687b6d ext/standard/file.c: Use more appropriate types 2024-08-21 13:06:18 +01:00
Gina Peter Bnayard 369eeb73ca ext/standard/file.c: Use RETURN_BOOL() instead of if-else 2024-08-21 13:06:18 +01:00
Christoph M. Becker d4263ddc40 Fix rename_variation12*.phpt parallel test conflicts (GH-15518)
For rename_variation12.phpt this is actually not necessary, since there
is no rename_variation11.phpt, but we still fix it to be in sync with
rename_variation12-win32.phpt which actually is prone to parallel
conflicts.

Since we already ran CI in the PR, we can now [skip ci].
2024-08-21 13:25:16 +02:00
Gina Peter Banyard 3059adae06 ext/standard: Improve checking of allowed_classes option (#15267)
* ext/standard: Add some unserializing tests

* ext/standard: Add proper type checking for values of the allowed_classes option array

* ext/standard: Check that class names are somewhat sensible for the allowed_classes option array

* Indicate type of value

* Add test for Stringable objects
2024-08-20 15:24:25 +01:00
Gina Peter Bnayard 775ca03eb8 ext/standard/crc32: Use zend_result return type and remove unused header 2024-08-20 14:18:50 +02:00
Gina Peter Bnayard ebfef2505d ext/standard/mail.c: Move php_mail_header_value_error_type enum out of header 2024-08-18 19:39:32 +02:00
Gina Peter Bnayard a171b20c7c ext/standard/mail.c: Move macros out of the header 2024-08-18 19:33:02 +02:00
Gina Peter Bnayard 312c919a2d ext/standard/mail.c: change return type of php_mail() to bool 2024-08-18 19:32:33 +02:00
Gina Peter Bnayard 962aba3b12 ext/standard/mail.c: Reduce scope of some variable declarations 2024-08-18 19:32:20 +02:00
Gina Peter Banyard c6e1e307a3 ext/standard: Throw a RequestParseBodyException instead of InvalidArgumentException (#15468)
Especially as this exception is thrown when there isn't an issue with an argument
2024-08-18 18:21:25 +01:00
Gina Peter Bnayard 3813ad10dc Remove unused ext/standard/basic_functions.h header inclusions
Those were probably included back in the day for the php_uint32 typedef
2024-08-18 18:20:22 +01:00
Gina Peter Bnayard 3e05c86c35 ext/standard: Remove deprecated php_uint32 and php_int32 typedefs
Use the standard uint32_t and int32_t types instead.
2024-08-18 18:20:22 +01:00
Gina Peter Banyard 059fe6c28b ext/standard/php_string.h: Remove declarations that do not have an implementation (#15402)
This was overlooked, by my younger self, in GH-8195.
2024-08-14 20:04:51 +01:00
Christoph M. Becker 390088bf55 Remove detection of unsupported Windows versions (GH-15399)
Windows 2008 and Vista are no longer supported as of PHP 7.2.0, and
Windows 2008 R2 and Windows 7 are no longer supported as of PHP 8.3.0.
Therefore we remove the respective detection code, and assert that
these versions can no longer be used.
2024-08-14 19:52:47 +02:00
Gina Peter Banyard 74bf894950 ext/standard/info.c: Throw ValueErrors on invalid inputs to php_uname() (#15385) 2024-08-14 13:20:26 +01:00
Gina Peter Banyard a79c70f574 [RFC] Convert exit (and die) from language constructs to functions (#13483)
RFC: https://wiki.php.net/rfc/exit-as-function
2024-08-14 12:44:12 +01:00
Gina Peter Banyard 02177848e4 Replace uses of php_dirname() with zend_dirname() (#15393)
This removes some needs to include the php_string.h header
2024-08-14 12:35:47 +01:00
Gina Peter Bnayard 0b8fbacd58 ext/standard/info.c: Remove unreachable conditional branch 2024-08-13 22:26:14 +02:00