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

124444 Commits

Author SHA1 Message Date
Christoph M. Becker 8a8e307cd5 Mark slow tests
Each of these tests took more than ten seconds on a recent AppVeyor CI
run; that appears to qualify them to be marked as slow tests.

Closes GH-7077.
2021-06-03 15:14:08 +02:00
David Carlier 007046fdd0 pcntl_rfork: following-up suggestions.
removing RFMEM constant.
treating beforehand the only case where rfork would return EINVAL.
2021-06-03 15:13:12 +02:00
Dmitry Stogov 643f3c2935 "http://" -> "https://" 2021-06-03 14:27:41 +03:00
Dmitry Stogov c658216425 JIT Refactoring:
- Move duplicate system independent functions from zend_jit_x86.dasc and
  zend_jit_arm64.dasc into zend_jit.c
  * zend_jit_is_constant_cmp_long_long()
  * zend_jit_needs_call_chain()
  * skip_valid_arguments()
  * zend_ssa_cv_info()
  * zend_jit_may_avoid_refcounting()
  * zend_get_known_property_info()
  * zend_may_be_dynamic_property()
- Move common definitions from zend_jit_x86.dasc and
  zend_jit_arm64.dasc into zend_jit.c
  * GCC_GLOBAL_REGS
  * PROFITABILITY_CHECKS
  * BP_JIT_IS
  * sp_adj_kind
  * sp_adj[]
- Remove unused DynAsm macros
  * ADDR_CMP (arm64)
- Inline and remove DynAsm macros used once
  * LOAD_BASE_ADDR (arm64 and x86)
  * PUSH_BASE_ADDR (x86)
  * MEM_OP3_3 (x86)
  * SET_Z_PTR (x86)
- Rename DynAsm macros
  * MEM_LOAD_OP_STORE -> MEM_UPDATE (arm64)
  * MEM_LOAD_OP_STORE_ZTS - > MEM_UPDATE_ZTS (arm64)
  * ADDR_OP1 -> PUSH_ADDR (x86)
  * ADDR_OP2_2 -> ADDR_STORE and ADDR_CMP (x86)
  * MEM_OP2_1_ZTS -> MEM_STORE_ZTS, MEM_CMP_ZTS, MEM_UPDATE_ZTRS (x86)
  * MEM_OP2_2 -> MEM_LOAD and MEM_LOAD_OP (x86)
  * MEM_OP2_2_ZTS -> MEM_LOAD_ZTS and MEM_LOAD_OP_ZTS (x86)
  * SSE_AVX_OP -> DOUBLE_CMP (x86)
  * SSE_GET_LONG -> DOUBLE_GET_LONG (x86)
  * SSE_GET_ZVAL_LVAL -> DOUBLE_GET_ZVAL_LVAL (x86)
  * SSE_GET_ZVAL_LVAL -> DOUBLE_GET_ZVAL_LVAL (x86)
  * SSE_GET_ZVAL_DVAL -> DOUBLE_GET_ZVAL_DVAL (x86)
  * SSE_SET_ZVAL_DVAL -> DOUBLE_SET_ZVAL_DVAL (x86)
2021-06-03 14:05:01 +03:00
Joe Watkins 5c3cb3583b Merge branch 'PHP-8.0'
* PHP-8.0:
  fix bug #72998
2021-06-03 10:34:00 +02:00
Joe Watkins 1143155fcb fix bug #72998
the function fn_complete in libedit null checks matches[2]
2021-06-03 10:33:10 +02:00
Dmitry Stogov 5de50e2817 Separate common code 2021-06-03 00:47:40 +03:00
Christoph M. Becker d5dd9d59ae Speed up test case
This test case did 100,000 includes of a non existing file to show the
memory leak; this is not necessary, because after the first failing
include, memory is not supposed to increase for further includes.

Closes GH-7088.
2021-06-02 23:19:38 +02:00
Ayesh Karunaratne a706d7302a Improve interface non-public method error message
Currently interface methods with visibility `private` or `protected` fail
with an error message:

  Access type for interface method A::b() must be omitted

However, explicitly setting visibility `public` is allowed and often desired.
This commit updates the error message to:

  Access type for interface method A::b() must be public
2021-06-02 20:08:36 +01:00
Hao Sun 467801d7bb JIT/AArch64: Code refactoring for macros (#7082)
* JIT/AArch64: Code refactoring for macros

Update the comments and rename arguments for some macros.

The following macros are renamed:
  SAFE_MEM_ACC_WITH_UOFFSET  -> MEM_ACC_64_WITH_UOFFSET
  SAFE_MEM_ACC_WITH_UOFFSET_32  -> MEM_ACC_32_WITH_UOFFSET
  SAFE_MEM_ACC_WITH_UOFFSET_BYTE -> MEM_ACC_8_WITH_UOFFSET
  MEM_STORE_BYTE_ZTS -> MEM_STORE_8_ZTS
  MEM_STORE_ZTS -> MEM_STORE_64_ZTS
  MEM_LOAD_ZTS -> MEM_LOAD_64_ZTS
  MEM_LOAD_BYTE_ZTS -> MEM_LOAD_8_ZTS
  ADD_IP_FROM_CST -> ADD_IP_WITH_CONST

The following macros are deprecated and removed:
  SET_Z_PTR, GET_Z_W2, SET_Z_W2

Change-Id: I767cf70f373e5f5a1090079e70f8e953a654da00

* Use MEM_ACCESS_*_WITH_UOFFSET

It's more accurate to use "MEM_ACCESS_*_WITH_UOFFSET" than
"MEM_ACC_*_WITH_UOFFSET".

Change-Id: I71479a809008848b61c4786016e6c10110e6aa8b

* Revert the updates for macros ADD_IP_WITH_CONST and LONG_ADD_SUB_WITH_IMM

As pointed by Dmitry, (int32_t) (1LL << 32) would make the assertion
"TRUE", which is not expected by us.

Change-Id: I767cf70f373e5f5a1090079e70f8e953a654da00
2021-06-02 22:32:17 +08:00
Dmitry Stogov 4a095a0252 Resolve CG(map_ptr_base) in disassembler 2021-06-02 15:17:41 +03:00
Nikita Popov 6ecc103439 Merge branch 'PHP-8.0'
* PHP-8.0:
  Try to fix libxml 2.9.12 tests
2021-06-02 12:22:48 +02:00
Nikita Popov 29b083dd0a Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Try to fix libxml 2.9.12 tests
2021-06-02 12:22:36 +02:00
Nikita Popov d818edeae2 Try to fix libxml 2.9.12 tests
The test expectations here were for PHP 8.0, try to adjust them
for PHP 7.4.
2021-06-02 12:21:45 +02:00
Nikita Popov 0aaa862fcf Add test for unsetting ReflectionClassConstant::$name
This test was supposed to be part of 50b4a7adf9.
2021-06-02 12:17:17 +02:00
Nikita Popov 96fe8141c3 Merge branch 'PHP-8.0'
* PHP-8.0:
  Skip test without ZMM
2021-06-01 12:08:04 +02:00
Nikita Popov 59a52d6942 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Skip test without ZMM
2021-06-01 12:07:51 +02:00
Nikita Popov d4f493b0b0 Skip test without ZMM 2021-06-01 12:07:33 +02:00
George Peter Banyard b6958bb847 Implement "Deprecate implicit non-integer-compatible float to int conversions" RFC. (#6661)
RFC: https://wiki.php.net/rfc/implicit-float-int-deprecate

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-05-31 15:48:45 +01:00
Nikita Popov e006fd4220 Adjust memory limit in one more test 2021-05-31 16:32:43 +02:00
Nikita Popov e9b005158f Fix output buffer discard on memory limit
Move this code directly into the error handler, and check the
heap->overflow flag. Discarding output here allows us to print
the normal memory limit message to standard output. Otherwise
nothing would be printed unless a different log medium was used,
which makes for a suboptimal debugging experience.
2021-05-31 16:30:36 +02:00
Peter van Dommelen 3a4ea6cb91 Don't automatically adjust memory_limit to 2M
As PHP has a minimum memory usage of 2M (size of allocator chunk),
setting a limit below that value is not meaningful and will be
automatically rounded up to the chunk size. Rather than doing this
silently, show the newly introduced error message.

The memory limit had to be increased to 2M for a number of tests.

tests/lang/bug45392 has been marked as XFAIL. This old bugfix is
not working as intended. The memory limit in main's `PG(memory_limit)`
differs from the one in zend_alloc. In zend_alloc the `AG(mm_heap)->limit`
is defined as `max(passed_value, ZEND_MM_CHUNK_SIZE)`. The check made in
an unclean shutdown will never be true unless the memory limit is lower
than ZEND_MM_CHUNK_SIZE, which happened to be the case in the test.
https://bugs.php.net/bug.php?id=45392
https://github.com/php/php-src/commit/fcc0fdd125fdb9e1713f91d027fe07d680a0cf36
2021-05-31 15:42:10 +02:00
Nikita Popov 1aafed5e98 Remove zend_set_memory_limit_ex() API
This was added temporarily for the PHP-8.0 branch to avoid an
ABI break.
2021-05-31 15:27:46 +02:00
Nikita Popov b4559e7ae4 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81070
2021-05-31 15:24:29 +02:00
Nikita Popov 324ad2f42c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81070

This is a non-trivial merge. To avoid an ABI break, a new
zend_set_memory_limit_ex() function is added.
2021-05-31 15:24:00 +02:00
Peter van Dommelen 1b3b5c94e5 Fixed bug #81070
When the memory limit is reduced using an `ini_set("memory_limit", ..)`
below the currently allocated memory, the out-of-memory check overflowed.
Instead of implementing additional checks during allocation,
`zend_set_memory_limit()` now validates the new memory limit. When
below the current memory usage the ini_set call will fail and throw
a warning.

This is part of GH-7040.
2021-05-31 15:18:58 +02:00
Nikita Popov 477f4fe67b Skip pcntl_rfork() in arginfo test
Same as pcntl_fork(), we don't want to have this side-effect in
this mass-test.
2021-05-31 14:55:55 +02:00
Nikita Popov 91eb201fd8 Allow initializing assignment to PDOStatement::$queryString
If the object is not created through PDO::prepare(), e.g. in a
mock scenario, it should still be possible to initialize the
$queryString property.

See bug #81084.
2021-05-31 14:54:29 +02:00
Christoph M. Becker 509d34955c Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix #76694: native Windows cert verification uses CN as sever name
2021-05-31 14:37:55 +02:00
Christoph M. Becker 108105b2c6 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #76694: native Windows cert verification uses CN as sever name
2021-05-31 14:36:57 +02:00
Christoph M. Becker 7fd48264de Fix #76694: native Windows cert verification uses CN as sever name
This is not guaranteed to work, since the actual server name may only
be given as SAN.  Since we're doing the peer verification later anyway
(using the respective context options as appropriate), there is no need
to even supply a server name when verifying against the Windows cert
store.

Closes GH-7060.
2021-05-31 14:35:17 +02:00
Nikita Popov fa9cb6c314 Fix typo in constant name 2021-05-31 14:33:51 +02:00
Joe Watkins 9c1159a6d6 Merge branch 'master' of github.com:php/php-src
* 'master' of github.com:php/php-src:
  Fix bug #81090 in JIT as well
  Fixed bug #81090
2021-05-31 13:40:21 +02:00
Joe Watkins 660585e25f fix stub for pcntl_rfork 2021-05-31 13:39:49 +02:00
Nikita Popov 445b649228 Fix bug #81090 in JIT as well 2021-05-31 12:39:36 +02:00
Nikita Popov c27dedb0c7 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed bug #81090
2021-05-31 12:34:21 +02:00
Nikita Popov ee74f2e57f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #81090
2021-05-31 12:33:59 +02:00
Nikita Popov 82f6f6da67 Fixed bug #81090
For concatenation, the in-place variant can be much more efficient,
because it will reallocate the string in-place. Special-case the
typed property compound assignment code for the case where we
concatenate to a string, in which case we know that the result
will also be a string, and we don't need the type check anyway.
2021-05-31 12:31:56 +02:00
David Carlier 95a9e558b6 Pull #6989 FreeBSD defines SO_ACCEPTFILTER 2021-05-31 11:40:20 +02:00
Bob Weinand 13d396bb59 Merge branch 'PHP-8.0' 2021-05-31 10:48:11 +02:00
Hao Sun e7be7f3f6c JIT/AArch64: Use ZR directly to zero FP register (#7081)
Zero register, i.e. xzr, can be used directly to zero FP register.

TODO: FMOV from ZR may be slow on some cores and the preferred
instructio is MOVI with immediate zero [1]. However, MOVI is not
recoginized by DynASM/arm64.

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=523d72071960

Change-Id: I0eaee4445e05adb45c6bb80ddb62ea02cdc9f4db
2021-05-31 16:47:26 +08:00
Bob Weinand 76a4ea5e2a Export ENV in .sh file generated by run-tests 2021-05-31 10:47:14 +02:00
Nikita Popov 27be6670b1 Correctly parse array_slice() argument in call_user_func_array() opt
We should be treating this argument using the normal zpp rules,
rather than performing a simple integer cast.
2021-05-31 10:38:25 +02:00
Nikita Popov 7db146eea7 Remove "inline" defines on Windows (#7071)
Newer MSVC versions support the `inline` keyword, so we do not need to explicitly define it. We also shouldn't define `inline` to `__forceinline`, as we already have `zend_always_inline` to indicate this requirement.
2021-05-31 10:05:18 +02:00
David Carlier 28382aa1ec pcntl: Adding pcntl_rfork support. 2021-05-31 09:19:15 +02:00
David CARLIER 20ef668978 pcntl add darwin specific flags for who/which especially (#7075)
PRIO_DARWIN_BG to be on part with pthread QOS class and
 energy efficiency.
2021-05-31 09:16:46 +02:00
Hao Sun 66826f644d JIT/AArch64: Use D registers for floating-point operations (#7080)
In AArch64, 32 registers, i.e. v0~v31, can be used by the SIMD and
floating-point operations. [1][2]

In PHP the floating-point operations use 64-bit DOUBLE type, and SIMD
operations are not supported currently. Hence we can use D registers
directly.

Note that "ZREG_V*" is kept to denote the register index.

[1]
https://developer.arm.com/documentation/den0024/a/ARMv8-Registers/NEON-and-floating-point-registers/Scalar-register-sizes
[2]
https://github.com/ARM-software/abi-aa/blob/2bcab1e3b22d55170c563c3c7940134089176746/aapcs64/aapcs64.rst#612simd-and-floating-point-registers

Change-Id: I286ce07a49e837b560e3401c742ec91fc561546b
2021-05-31 14:28:33 +08:00
Hao Sun 7c2a3a9400 JIT/AArch64: [macos][ZTS] Support fast path for tlv_get_addr (#7042)
* JIT/AArch64: [macos][ZTS] Support fast path for tlv_get_addr

Access to TLV(thread local variable) in macOS is in "dynamic" form and
function tlv_get_addr() is invoked to resolve the address. See the
example in [1].

Note there is one struct TLVDescriptor [2] for each TLV. The first
member holds the address of function tlv_get_addr(), and the other two
members, "key" and "offset", would be used inside tlv_get_addr().

The disassembly code for function tlv_get_addr() is shown in [3]. With
the value from system register, i.e. tpidrro_el0, together with "key"
and "offset", the TLV address can be obtained.

Note that the value from tpidrro_el0 varies for different threads, and
unique address for TLV is resolved.

It's worth noting that slow path would be executed, i.e. function
tlv_allocate_and_initialize_for_key(), for the first time of TLV access.

In this patch:
1. "_tsrm_ls_cache" is guaranteed to be accessed before any VM/JIT code
during the request startup, e.g. in init_executor(), therefore, slow
path can be avoided.

2. As TLVDecriptor is immutable and zend_jit_setup() executes once, we
get this structure in tsrm_get_ls_cache_tcb_offset(). Note the 'ldr'
instruction would be patched to 'add' by the linker.

3. Only fast path for tlv_get_addr() is implemented in macro
LOAD_TSRM_CACHE.

With this patch, all ~4k test cases can pass for ZTS+CALL in macOS on
Apple silicon.

[1] https://gist.github.com/shqking/4aab67e0105f7c1f2c549d57d5799f94
[2]
https://opensource.apple.com/source/dyld/dyld-195.6/src/threadLocalVariables.c.auto.html
[3] https://gist.github.com/shqking/329d7712c26bad49786ab0a544a4af43

Change-Id: I613e9c37e3ff2ecc3fab0f53f1e48a0246e12ee3
2021-05-31 14:27:00 +08:00
Anatol Belski 805b391d99 NEWS: UPGRADING.INTERNALS: Add PCRE2 10.37 info
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2021-05-30 13:06:16 +02:00
Nikita Popov 8c73dfe062 Remove silly code from openssl_pkey_free() test
W A T
2021-05-29 15:48:58 +02:00