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

5602 Commits

Author SHA1 Message Date
Ilija Tovilo
9a250cc9d6 Add separate static property through trait if parent already declares it
Fixes GH-10935
Closes GH-10937
2023-04-06 14:27:24 +02:00
Dmitry Stogov
e1c6fb76c0 JIT support for delayed destructor for zend_assign_to_typed_ref/prop 2023-04-04 18:55:47 +02:00
Dmitry Stogov
24acb4f134 Delay destructor for zend_std_write_property 2023-04-04 18:55:47 +02:00
Joan Miquel
9e8614233c Add ngx-php to opcache supported sapis (#11013)
This SAPI embed PHP in Nginx server.
https://github.com/rryqszq4/ngx-php

And in the Techempower benchmarks, it's the fastest PHP SAPI.
https://www.techempower.com/benchmarks/#section=data-r20
2023-04-04 16:58:59 +02:00
Máté Kocsis
f42992f580 Remove name field from the zend_constant struct (#10954)
As global constant names are case-sensitive now, we don't have to store them separately above the constant table.
2023-04-03 22:13:47 +02:00
Dmitry Stogov
9a8123142e Merge branch 'PHP-8.2'
* PHP-8.2:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
2023-04-03 18:15:59 +03:00
Dmitry Stogov
962aac698e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
2023-04-03 18:15:46 +03:00
Dmitry Stogov
8a749c79d0 Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference 2023-04-03 18:15:41 +03:00
Ilija Tovilo
50f58c8923 Add ASAN XLEAK support
Only disable LSAN instead of skipping the test. This way we can still detect
memory issues which is arguably more important anyway.

Closes GH-10996
2023-04-03 08:02:19 +02:00
Dmitry Stogov
22d5d146e5 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix incorrect optimization
2023-03-27 17:58:35 +03:00
Dmitry Stogov
1f5d9534ae Fix incorrect optimization
Fixes oss-fuzz #57482
2023-03-27 17:57:54 +03:00
Ilija Tovilo
b73b70f097 Rename --with-opcache-capstone to --with-capstone (#10952) 2023-03-27 12:59:27 +02:00
George Peter Banyard
d7c351ea54 Propagate UTF-8 flag during Rope operations (#10915) 2023-03-26 14:18:46 +01:00
Michael Orlitzky
87922411bf Use capstone explicitly, drop oprofile (GH 10876) (#10918)
* ext/opcache/config.m4: new --with-opcache-capstone flag.

Until now, libcapstone has been detected "automagically" and used for
JIT disassembly whenever it is available on the system used to compile
PHP. This can have some unintended consequences, however: many users
have capstone installed for some other purpose, and are surprised to
find that PHP breaks when capstone is later uninstalled.

To address this, we have introduced a new --with-opcache-capstone flag
that is disabled by default, and that makes the user's preference
explicit. It is ignored unless the JIT is enabled.

* ext/opcache: drop support for the oprofile JIT profiler.

Recently we have replaced the "automagic" detection of capstone at
build time with a --with-opcache-capstone flag. The detection of
oprofile causes similar problems and would likely have the same
solution; however, it was suggested that we might remove oprofile
altogether. So, this commit removes it:

  * Remove the detection bits from ext/opcache/config.m4.
  * Drop HAVE_OPROFILE ifdef blocks.
  * Delete ext/opcache/jit/zend_jit_oprofile.c.
  * Undefine the ZEND_JIT_DEBUG_OPROFILE constant.
2023-03-25 15:12:34 +01:00
Ilija Tovilo
9d5f2f1343 Use new ZSTR_INIT_LITERAL macro (#10879) 2023-03-20 16:19:05 +01:00
Arnaud Le Blanc
bdd782e267 Merge branch 'PHP-8.2'
* PHP-8.2:
  Remove xfail from tests that do not fail anymore (#10871)
2023-03-17 18:15:03 +01:00
Arnaud Le Blanc
d87b670544 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Remove xfail from tests that do not fail anymore (#10871)
2023-03-17 18:13:31 +01:00
Arnaud Le Blanc
53763e14b7 Remove xfail from tests that do not fail anymore (#10871) 2023-03-17 18:12:51 +01:00
Niels Dossche
f9375dc723 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix module shutdown crash during ZTS JIT shutdown
2023-03-13 20:12:37 +01:00
Niels Dossche
ae39069051 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix module shutdown crash during ZTS JIT shutdown
2023-03-13 20:12:30 +01:00
Niels Dossche
b3e28e2290 Fix module shutdown crash during ZTS JIT shutdown
Commit a21195650e fixed a leak by adding a TSRM destructor for the
JIT globals in ZTS mode. In case the main thread shuts down the TSRM, it
will call all the destructors. The JIT globals destructor will be
invoked, but will always access the main thread globals using JIT_G.
This means that instead of freeing the JIT globals in the different
threads, the one in the main thread is freed repeatedly over and over,
crashing PHP. Fix it by always passing the pointer instead of relying on
JIT_G.

Closes GH-10835.
2023-03-13 20:12:13 +01:00
Bob Weinand
a00e4a3649 Merge branch 'PHP-8.2' 2023-03-13 12:39:40 +01:00
Bob Weinand
ce2000d9be Merge branch 'PHP-8.1' of github.com:php/php-src into PHP-8.2 2023-03-13 12:39:15 +01:00
Bob Weinand
1015f1ff61 Add test, fix x86 JIT
Signed-off-by: Bob Weinand <bobwei9@hotmail.com>
2023-03-13 12:36:59 +01:00
Bob Weinand
c53e8d3e30 Handle zend_execute_internal in JIT 2023-03-13 12:36:59 +01:00
Niels Dossche
5c058d7b15 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10801: Named arguments in CTE functions cause a segfault
2023-03-10 19:31:19 +01:00
Niels Dossche
c4508422eb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10801: Named arguments in CTE functions cause a segfault
2023-03-10 19:27:17 +01:00
Niels Dossche
2c53d63197 Fix GH-10801: Named arguments in CTE functions cause a segfault
Fixes GH-10801

Named arguments are not supported by the constant evaluation routine, in
the sense that they are ignored. This causes two issues:
  - It causes a crash because not all oplines belonging to the call are
    removed, which results in SEND_VA{L,R} which should've been removed.
  - It causes semantic issues (demonstrated in the test case).

This case never worked anyway, leading to crashes or incorrect behaviour,
so just prevent CTE of calls with named parameters for now.
We can choose to support it later, but introducing support for this in
a stable branch seems too dangerous.

This patch does not change the removal of SEND_* opcodes in remove_call
because the crash bug can't be triggered anymore with this patch as
there are no named parameters anymore and no variadic CTE functions
exist.

Closes GH-10811.
2023-03-10 19:22:44 +01:00
Ilija Tovilo
0760a57205 [skip ci] Remove references to Azure Pipelines 2023-03-10 01:32:28 +01:00
Niels Dossche
b39ff334a3 Merge branch 'PHP-8.2'
* PHP-8.2:
  Re-add some CTE functions that were removed from being CTE by a mistake
  Fix GH-8065: opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context
  Fix GH-8646: Memory leak PHP FPM 8.1
2023-03-07 20:36:41 +01:00
Niels Dossche
7682868dd1 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-8065: opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context
  Fix GH-8646: Memory leak PHP FPM 8.1
2023-03-07 20:26:57 +01:00
Niels Dossche
85df512a12 Fix GH-8065: opcache.consistency_checks > 0 causes segfaults in PHP >= 8.1.5 in fpm context
Disable opcache.consistency_checks.

This feature does not work right now and leads to memory leaks and other
problems. For analysis and discussion see GH-8065. In GH-10624 it was
decided to disable the feature to prevent problems for end users.
If end users which to get some consistency guarantees, they can rely on
opcache.protect_memory.

Closes GH-10798.
2023-03-07 20:17:55 +01:00
Michael Orlitzky
fa65873502 */*.m4: update main() signatures.
The next generation of C compilers is going to enforce the C standard
more strictly:

  https://wiki.gentoo.org/wiki/Modern_C_porting

One warning that will soon become an error is -Wstrict-prototypes.
This is relatively easy to catch in most code (it will fail to
compile), but inside of autoconf tests it can go unnoticed because
many feature-test compilations fail by design. For example,

  $ export CFLAGS="$CFLAGS -Werror=strict-prototypes"
  $ ./configure
  ...
  checking if iconv supports errno... no
  configure: error: iconv does not support errno

(this is on a system where iconv *does* support errno). If errno
support were optional, that test would have "silently" disabled
it. The underlying issue here, from config.log, is

  conftest.c:211:5: error: function declaration isn't a prototype
  [-Werror=strict-prototypes]
    211 | int main() {

This commit goes through all of our autoconf tests, replacing main()
with main(void). Up to equivalent types and variable renamings, that's
one of the two valid signatures, and satisfies the compiler (gcc-12 in
this case).

Fixes GH-10751
2023-03-07 15:32:30 +00:00
Ilija Tovilo
3f7dadfeca Fix readonly+clone JIT issues
Closes GH-10748
2023-03-07 13:20:52 +01:00
Ilija Tovilo
9944f58d3f Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10709: UAF in recursive AST evaluation
2023-03-06 15:03:19 +01:00
Ilija Tovilo
1978a7b393 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10709: UAF in recursive AST evaluation
2023-03-06 14:58:25 +01:00
Ilija Tovilo
7202fe16b7 Fix GH-10709: UAF in recursive AST evaluation
Fixes https://oss-fuzz.com/testcase-detail/6445949468934144
Closes GH-10718
2023-03-06 14:55:34 +01:00
Ilija Tovilo
95fbd2039f Fix -Wmaybe-uninitialized warning in JIT 2023-03-05 21:35:22 +01:00
Ilija Tovilo
ad7b90b674 Ignore -Warray-bounds compiler warning in JIT (#10789)
The out-of-bounds pointer is intentional.
2023-03-05 21:30:03 +01:00
David Carlier
02e8c16dfd Merge branch 'PHP-8.2' 2023-03-03 12:45:10 +00:00
David Carlier
8b70393c23 Merge branch 'PHP-8.1' into PHP-8.2 2023-03-03 12:44:33 +00:00
David Carlier
ffc2a53a9b Fix GH-10728: opcache capstone header's inclusion.
Remove capstone include folder.
For most of the supported systems it worked fine somehow despite
 the pkg-config --cflags, but is always include it even on Linux.

Closes GH-10732.
2023-03-03 12:43:12 +00:00
Ilija Tovilo
86669774ae Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix missing readonly modification error with inc/dec in JIT
2023-03-02 11:31:42 +01:00
Ilija Tovilo
7934a0fcfb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix missing readonly modification error with inc/dec in JIT
2023-03-02 11:31:29 +01:00
Ilija Tovilo
df93146a15 Fix missing readonly modification error with inc/dec in JIT
Closes GH-10746
2023-03-02 11:29:53 +01:00
Ilija Tovilo
da4167b918 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix unescaped {TMP} variables in tests
2023-03-01 13:25:34 +01:00
Ilija Tovilo
2b5aac9303 Fix unescaped {TMP} variables in tests
On Windows {TMP} can return ~, which will result in a parse error
2023-03-01 13:24:39 +01:00
Dmitry Stogov
28be84a146 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix Zend/tests/type_declarations/variance/class_order_autoload1.phpt test failre introduced by 44e5c04e55
2023-02-28 23:05:40 +03:00
Dmitry Stogov
dcf2810cd1 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix Zend/tests/type_declarations/variance/class_order_autoload1.phpt test failre introduced by 44e5c04e55
2023-02-28 23:05:30 +03:00
Dmitry Stogov
18b43d2950 Fix Zend/tests/type_declarations/variance/class_order_autoload1.phpt
test failre introduced by 44e5c04e55

This ASSERT-ion path was never reached becuase of the bug fixed by
44e5c04e55. It's possible in case of
circular class dependencies that may resolved by __autoload().
Unfortunately these circular dependencies can't be stored in the
inheritace cahce.
2023-02-28 22:57:52 +03:00