1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 12:42:29 +02:00
Commit Graph

19248 Commits

Author SHA1 Message Date
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
Ilija Tovilo
b839c5f1af Fix building of callgraph including preloaded symbols (GH-15545)
This issue was introduced in GH-15021. When building the call graph, we can now
see preloaded functions. However, building the call graph involves adding the
function to the caller list of the callee, which we don't want to do for
functions not coming from the script.

Fixes GH-15490
2024-08-26 17:22:04 +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
062e9f9134 Remove unused buffer variables (#15550)
These emit warning: unused variable 'buffer'.
2024-08-23 16:40:19 +02:00
Gina Peter Banyard
d9695401e4 Zend: Voidify virtual_cwd_(de)activate() (#15554)
It always returned 0
2024-08-23 15:28:37 +01:00
Ilija Tovilo
8fcf34d598 Remove ZEND_ACC_ABSTRACT from prop variance check
Abstract properties are now virtual, unless they actually contain concrete hook
implementations using the backing field.
2024-08-23 16:13:23 +02:00
Peter Kokot
f952263bcd Fix Solaris 10 build: missing libproc.h (#15525)
The libproc.h header file was added on Solaris as of 11.4.

* Also add guard check to the entire function
* When libproc.h isn't available also sys/procfs.h is redundant
* Move the <sys/lwp.h> out of the guard
* Exclude more stuff from Solaris 10
2024-08-22 20:26:44 +02:00
Peter Kokot
6b809c8890 Autotools: Fix stack direction check (#15528)
On Solaris 10 and GCC 4.9 check failed with error in config.log:
error: missing binary operator before token "("

The __has_builtin must be checked in its own `#ifdef/defined` line
above the `#if __has_builtin(....` usage.
2024-08-21 22:50:11 +02:00
Gina Peter Bnayard
5853cdb73d Use "must not" instead of "cannot" wording 2024-08-21 21:12:17 +01:00
Gina Peter Bnayard
96d572a18e Zend: Add helper for "cannot be empty" ValueError 2024-08-21 21:12:17 +01:00
Ilija Tovilo
327588abf9 Replace OBJ_PROP_PTR_TO_NUM() with zend_get_property_info_for_slot()
I wasn't aware such a function already existed.
2024-08-20 18:44:42 +02:00
Christoph M. Becker
c9ea4d76af Revert "Merge branch 'PHP-8.3'"
This reverts commit a2313cea5a, reversing
changes made to 588029a989.
2024-08-20 16:34:52 +02:00
Christoph M. Becker
a2313cea5a Merge branch 'PHP-8.3'
* PHP-8.3:
  zend_max_execution_timer: fix gcc compatibility (#15447)
2024-08-20 16:31:55 +02:00
Go Kudo
89daa8354f zend_max_execution_timer: fix gcc compatibility (#15447) 2024-08-20 16:28:03 +02:00
Christoph M. Becker
b75775ea39 Revert "Merge branch 'PHP-8.3'"
This reverts commit b363a606a4, reversing
changes made to 3ed5eee5d3.
2024-08-20 16:09:46 +02:00
Christoph M. Becker
b363a606a4 Merge branch 'PHP-8.3'
* PHP-8.3:
2024-08-20 15:38:34 +02:00
Ilija Tovilo
b6d7c011b8 Fix virtual properties in get_class_vars() (GH-15494)
Fixes GH-15456
2024-08-19 17:39:31 +02:00
Ilija Tovilo
60f87f29bb Fix various hooked object iterator issues (GH-15394)
Fixes GH-15187
2024-08-19 15:46:20 +02:00
Ilija Tovilo
36b1977415 Fix missing compile error when declaring hooked props on readonly classes (GH-15439)
Fixes GH-15419
2024-08-19 14:58:55 +02:00
Ilija Tovilo
770616b823 Fix param with hooks but no visibility not treated as cpp (GH-15442)
Fixes GH-15438
2024-08-19 14:53:54 +02:00
Christoph M. Becker
f16cb1866a Fix ZEND_FASTCALL definition wrt. x64 Windows clang builds (GH-15425)
As is, MSVC uses `__vectorcall`, but clang uses `__cdecl`.  This
obviously is bad for interoperability (and causes link issues), and is
likely worse for FFI which offers some limited (but likely sufficient
for our purposes) support for `__vectorcall` on Windows.

Since clang claims to support `__vectorcall` as of 3.6.0, and we bumped
the requirements to clang 4.0.0 already, there shouldn't be any issues.
2024-08-18 12:20:09 +02:00
Juliette
4c5767f62f PHP 8.4 | Exit as function: fix incorrect parameter name (#15433)
Follow up on 13483

As previously reported in https://github.com/php/php-src/pull/13483#discussion_r1718546927:

> The parameter names seem to be incorrect.
>
> It should be `$status`, not `$code`.
>
> The RFC explicitly uses that parameter name in the proposal: https://wiki.php.net/rfc/exit-as-function#proposal
>
> It is also the name already used in the [manual](https://www.php.net/exit).
>
> Lastly, the parameter name `$status` better covers what can be passed: either a status _message_ or a status _code_.
> While `$code` would read pretty weird when passing a message:
> ```php
> exit(code: 'message');
> ```

This commit attempts to fix this.

Includes adding a test for exit/die using a named argument.

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
2024-08-16 22:35:16 +01:00
Go Kudo
05d92db5e5 Merge branch 'PHP-8.3' 2024-08-16 20:23:14 +00:00
Go Kudo
d87fd356dc Merge branch 'PHP-8.2' into PHP-8.3
# Conflicts:
#	NEWS
2024-08-16 20:21:51 +00:00
Go Kudo
836e6fa900 zend_max_execution_timer: fix gcc compatibility (#15447) 2024-08-17 05:20:04 +09:00
Go Kudo
9168b18c84 Merge branch 'PHP-8.3' 2024-08-17 02:57:12 +09:00
Go Kudo
6140f9a6f7 Merge branch 'PHP-8.2' into PHP-8.3 2024-08-17 02:54:38 +09:00
Go Kudo
ec9cdcd2bc Fix MSan false-positive in zend_max_execution_timer (#15408)
Explicitly mark memory regions as unpoisoned for zend_max_execution_timer on ZTS, as MemorySanitizer in clang >= 18 causes false positives.
2024-08-17 02:54:03 +09:00
Remi Collet
a6b7f134a9 exit_as_funtion RFC follow-up: ensure default INI settings used in status test (#15420) 2024-08-15 11:13:32 +01:00
Gina Peter Bnayard
4a4aae540b Zend/zend_object_handlers.c: Remove unused include 2024-08-15 00:08:19 +02: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
Jakub Zelenka
0b61b8dc99 PHP-8.3 is now for PHP-8.3.12-dev 2024-08-13 20:16:40 +01:00
Christoph M. Becker
65c6d72319 Drop FASTCALL on variadic functions (GH-15389)
This is unlikely to be properly supported by compilers anyway, see
<https://github.com/php/php-src/pull/2975>.
2024-08-13 19:46:48 +02:00
Sergey Panteleev
84d8fa9f53 PHP-8.2 is now for PHP 8.2.24-dev 2024-08-13 17:18:16 +03:00
Ilija Tovilo
be6dee3c5d Reset seen symbols when ending namespace (GH-15244)
Previously, seen symbols were never cleaned during the compilation of a single
file. This makes it impossible to use a class or function from a different
namespace if such a symbol is also declared within the same file. This is
inconsistent with how it would work when split into different files.
2024-08-13 15:47:14 +02:00
Gina Peter Bnayard
5622def429 Add more tests covering deprecation of _ as CE name 2024-08-13 14:37:40 +02:00
Ilija Tovilo
a4772a0c47 [skip ci] Remove unclosed vim code folding 2024-08-12 18:50:38 +02:00
Gina Peter Banyard
0a23b0678d Deprecate using "_" as a class name (#15360)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_using_a_single_underscore_as_a_class_name
2024-08-12 16:10:30 +01:00
Arnaud Le Blanc
c02c1d4474 Change YIELD/YIELD_FROM to do not increment opline (#15328)
YIELD and YIELD_FROM increment opline before returning, but in most places
we need the opline to point to the YIELD and YIELD_FROM.

Here I change YIELD / YIELD_FROM to not increment opline. This simplifies the
code and fixes GH-15275 in a better way.

Closes GH-15328
2024-08-10 16:09:47 +02:00
Arnaud Le Blanc
b43dd10bbb Merge branch 'PHP-8.3'
* PHP-8.3:
  [ci skip] NEWS for GH-15275
  [ci skip] NEWS for GH-15275
  Fix crash during GC of suspended generator delegate (#15275)
2024-08-10 16:08:19 +02:00
Arnaud Le Blanc
ba9f65bacd Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS for GH-15275
  Fix crash during GC of suspended generator delegate (#15275)
2024-08-10 15:48:43 +02:00
Arnaud Le Blanc
c767fec2d0 Fix crash during GC of suspended generator delegate (#15275) 2024-08-10 15:46:31 +02:00
Ilija Tovilo
5c739acb2a [skip ci] Mark stack limit tests with high memory limit as slow 2024-08-09 20:29:58 +02:00
Niels Dossche
00001c4a0c Fix GH-15292: Dynamic AVX detection is broken for MSVC
See https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170
For x64, either _M_X64 or _M_AMD64 would work but I'm going with what's
already used in php-src.

Closes GH-15301.
2024-08-09 18:11:46 +02:00
Gina Peter Banyard
1e3d918936 ext/core: Deprecate passing E_USER_ERROR to trigger_error() (#15308)
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_e_user_error_to_trigger_error
2024-08-09 15:51:07 +01:00
Peter Kokot
d7a8a04eb9 Autotools: Remove too basic optimization flag cleanup
The optimization flags are removed in configure.ac when using the
'--enable-debug' configure option (which also adds the '-O0'). When
using '--enable-debug-assertions' option, the optimization flags ideally
shouldn't be removed and this case never actually happen because the
CFLAGS at this point in ZEND_INIT contain all sorts of other flags also,
so it's redundant as it never gets executed.

Closes GH-15305
2024-08-09 13:56:08 +02:00
Ilija Tovilo
46ee0fb304 Disallow indirect modification on readonly properties within __clone() (#15012)
Indirect modification isn't allowed in __construct() because it allows
references to leak, so it doesn't make much sense to allow it in __clone().
2024-08-09 11:56:16 +02:00
Peter Kokot
5c870751f2 Autotools: Sync CS in Zend.m4 (#15304)
- Autoconf sets the GCC variable to either "yes" if GNU C compatible
  compiler is detected (like gcc or clang) or to an empty value
  otherwise.
- AX_CHECK_COMPILE_FLAG arguments quoted and empty arguments trimmed
2024-08-09 01:38:42 +02:00
Peter Kokot
02e22a5d09 Autotools: Remove DEBUG_CFLAGS (#15300)
DEBUG_CFLAGS is at this point redundant variable.
2024-08-09 01:21:44 +02:00