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

125653 Commits

Author SHA1 Message Date
Dmitry Stogov 6f65a1b263 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed error message
2021-09-15 14:59:14 +03:00
Dmitry Stogov de20a89b06 Fixed error message 2021-09-15 14:58:55 +03:00
Dmitry Stogov 46c09a34d5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fixed bug #79576 ("TYPE *" shows unhelpful message when type is not defined)
2021-09-15 14:53:00 +03:00
Dmitry Stogov 594cba7f8e Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #79576 ("TYPE *" shows unhelpful message when type is not defined)
2021-09-15 14:49:35 +03:00
Dmitry Stogov 0badc7de96 Fixed bug #79576 ("TYPE *" shows unhelpful message when type is not defined) 2021-09-15 14:48:33 +03:00
Nikita Popov ce105f655a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Handle undef assignment to typed ref
2021-09-15 10:58:41 +02:00
Nikita Popov 3ee85ccd4a Handle undef assignment to typed ref 2021-09-15 10:58:01 +02:00
Hao Sun d736496226 JIT/arm64: fixed unsafe immediate encoding in commit d4ed6b6 (#7494)
In my local performance testing, function JIT/arm64 failed for wordpress
benchmark after commit d4ed6b6 (including the follow-up fix commit
487efac).

The root cause lies in that immediate encoding for ADD instruction is
unsafe. In this patch, we use the safe macro ADD_SUB_64_WITH_CONST_32.

Besides, safe macro MEM_ACCESS_64_WITH_UOFFSET is used for the two sites
where `opline->result.num` is used as the offset to access memory.

Change-Id: I4704ff27e9527e70061046d634652600e55ccc4f
2021-09-15 14:29:53 +08:00
Patrick Allaert cba708bbb6 Configuring for 8.1.0RC3 2021-09-14 18:17:42 +02:00
Nikita Popov 25588878bc Apply fix for ARM JIT as well 2021-09-14 16:29:22 +02:00
Tim Starling 781e6b4d21 Fix O(N) performance of DOMNode::replaceChild() and DOMNode::removeChild()
Don't loop over all children to determine if the target node really is a
child, just trust the parent pointer. Add tests.
2021-09-14 15:30:34 +02:00
Nikita Popov a827742b2f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix JIT for recursive call with too few args
2021-09-14 15:15:28 +02:00
Nikita Popov 10bbff8758 Fix JIT for recursive call with too few args
We may not generate labels for all leading RECVs. Don't generate
a direct jump if we have less arguments than required.
2021-09-14 15:15:14 +02:00
Nikita Popov 54bbee96ba Check for no uses before removing result operand
It's possible for there to still be phi uses.
2021-09-14 13:20:28 +02:00
Nikita Popov fa3d603ba2 Mark ASSIGN result as UNUSED in SCCP
We can't drop the ASSIGN entirely, but we should mark the result
as UNUSED. Otherwise we'll replace uses of it in operands and
will not free the ASSIGN result value. This can happen with
non-interned strings, but possibly there's some other cases that
can trigger this as well.
2021-09-14 13:16:51 +02:00
Nikita Popov 260d2acdb4 Fix memory leak in array unpack with refcounted numeric string key 2021-09-14 12:14:12 +02:00
Nikita Popov e7de9b2091 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix func/class name use after free on opcache OOM condition
2021-09-14 12:03:03 +02:00
Nikita Popov 10e9f6b340 Fix func/class name use after free on opcache OOM condition
This can occur on opcache OOM conditions, where the function/class
names are not interned and the script does not get cached. In
that case the functions/classes get transferred from the persistent
script to the global tables, without incrementing the key refcount.
To mirror that, we should also not try to free the keys when freeing
the persistent script. For this by setting the number of elements
to zero, which will free only the hashtable structure itself.
2021-09-14 12:00:44 +02:00
Nikita Popov a2fc14c14f Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix BIND_STATIC may_throw check
2021-09-14 10:10:51 +02:00
Nikita Popov 1b376b06fb Fix BIND_STATIC may_throw check
This is supposed to index into arData, not the HashTable itself.
2021-09-14 10:09:32 +02:00
Tyson Andre 27976d7dc7 Merge branch 'PHP-8.0' into PHP-8.1 2021-09-13 21:18:56 -04:00
Tyson Andre 753645a6f8 Merge remote-tracking branch 'origin/PHP-7.4' into PHP-8.0 2021-09-13 21:00:53 -04:00
Tyson Andre b053192a03 Fix #81429: Handle resizing in SplFixedArray::offsetSet (#7487)
offsetSet did not account for the fact that the array may no longer exist after
the field is overwritten. This fixes that.

Add test of resizing both to the empty array and a smaller array - there should
be no valgrind warnings with a proper fix.

Alternate approach to #7486 (described in https://bugs.php.net/bug.php?id=81429)
2021-09-13 20:59:06 -04:00
Nikita Popov fe984c7cb5 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Use wildcard for error message
2021-09-13 22:47:13 +02:00
Nikita Popov 5d702e33a2 Use wildcard for error message
This differs depending on build type.
2021-09-13 22:46:26 +02:00
Nikita Popov ba03c5fb4c Try to fix test 2021-09-13 21:07:46 +02:00
Dmitry Stogov 6d1a2b3aed Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Properly check if BIND_STATIC may throw
2021-09-13 21:59:47 +03:00
Dmitry Stogov ebd1a0a656 Properly check if BIND_STATIC may throw 2021-09-13 21:57:26 +03:00
Nikita Popov 8c601edada Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  BIND_STATIC may throw
2021-09-13 17:25:13 +02:00
Nikita Popov b610dce079 BIND_STATIC may throw
The evaluation of the initializer may throw. This could be refined
by checking whether the initializer is a constant AST. For now
just fix the miscompile.
2021-09-13 17:23:57 +02:00
Nikita Popov 133afe8591 Fix JIT call chain check without call opcode
The do_fcall opcode may have been optimized away if an opcode like
exit is present in the arguments. In that case the opcode scan
would go past the end of the op array.
2021-09-13 16:48:38 +02:00
Bob Weinand a8f06346ad Merge remote-tracking branch 'origin/PHP-8.0' into PHP-8.1 2021-09-13 16:15:55 +02:00
Bob Weinand 12b0f1b7cc Fix #81435 Observer current_observed_frame may point to an old (overwritten) frame
Ensure current_observed_frame always points to an actually observed frame.
This solution has a caveat of being O(stack size), with the worst case occurring if there are a lot of frames between the current and previous observed frames.
An O(1) solution would require keeping track of the previous observed frame, which would require some additional frame attached metadata, which is best not attempted in an already released version.
2021-09-13 15:58:58 +02:00
Nikita Popov 86d470f3e0 Reset CE cache slots on opcache reset
Permanent opcache interned strings could have ce_cache pointing to
non-permanent map_ptr slots. On reset, those would be left dangling.
Clear any non-permanent ce_cache slots when the interned string
state is reset.

This was fun to debug...
2021-09-13 15:20:34 +02:00
Remi Collet b3646440b1 Don't rely on libgd unused constants 2021-09-13 14:48:13 +02:00
Christoph M. Becker 311b1de649 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81424: PCRE2 10.35 JIT performance regression
2021-09-13 14:38:37 +02:00
Christoph M. Becker 12e79ddae4 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81424: PCRE2 10.35 JIT performance regression
2021-09-13 14:35:49 +02:00
Christoph M. Becker a2471383fe Fix #81424: PCRE2 10.35 JIT performance regression
We backport the respective upstream fix[1] to our bundled pcre2lib.

[1] <https://github.com/PhilipHazel/pcre2/commit/dc5f96663597572f694147aeec3525003c351123>

Closes GH-7484.
2021-09-13 14:34:13 +02:00
Christoph M. Becker 9ffa3f9ba3 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
2021-09-13 12:14:32 +02:00
Christoph M. Becker 6fbdf69628 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
2021-09-13 12:13:09 +02:00
Viktor 424c265478 Fix #81433: DOMElement::setIdAttribute() called twice may remove ID
We must only remove the attribute id, if the user requested that.

Closes GH-7482.
2021-09-13 12:11:36 +02:00
Nikita Popov 9042c7aac6 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Handle undef value in assign_dim jit
2021-09-13 11:10:03 +02:00
Nikita Popov e7663785a7 Handle undef value in assign_dim jit
We should report the undefined variable here and convert it to
null. Passing on undef is particularly insidious here, because
a write_dimension handler may insert it into a hash table
(observed with WeakMap).
2021-09-13 11:09:00 +02:00
Dmitry Stogov 971142a12a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fixed exit from CALL VM with GCC Global Register Variables
2021-09-13 11:40:45 +03:00
Hao Sun cfb21e8dc1 JIT: Fixed exit from CALL VM with GCC Global Register Variables
PHP JIT supports three configurations: HYRBID, CALL with global register
variables feature(CALL+GRV for short), and CALL+noGRV.

CALL+GRV mode can be built with the following commands:

```
  php Zend/zend_vm_gen.php --with-vm-kind=CALL
  ./buildconf -f; ./configure; make
```

About 230 test cases failed for tracing JIT under CALL+GRV mode on both
x86 and arm64 machines.

For CALL+GRV mode, the condition to determine whether the execution of
an oparray is finished, is "opline == NULL". See function execute_ex()
around line "if (UNEXPECTED(!OPLINE)) {".

However, such cleanup operation is missing for the JIT wrapper
zend_jit_trace_counter_helper(), and the trace_halt stub function.

Tests:
1. test cases: all .phpt test cases under "Zend/tests/ tests/
ext/opcache/tests/jit/".
2. both JIT/x86 and JIT/arm64: function JIT, tracing JIT and tracing JIT
with "--repeat 3"
3. execution modes: NTS/ZTS, HYBRID/CALL+GRV/CALL+noGRV

In my local test, these test cases passed under all JIT configrations.
2021-09-13 11:35:12 +03:00
Nikita Popov 76348f3378 Allow using readonly as function name
Don't treat "readonly" as a keyword if followed by "(". This
allows using it as a global function name. In particular, this
function has been used by WordPress.

This does not allow other uses of "readonly", in particular it
cannot be used as a class name, unlike "enum". The reason is that
we'd still have to recognize it as a keyword when using in a type
position:

    class Test {
        public ReadOnly $foo;
    }

This should now be interpreted as a readonly property, not as a
read-write property with type `ReadOnly`. As such, a class with
name `ReadOnly`, while unambiguous in most other circumstances,
would not be usable as property or parameter type. For that
reason, we do not support it at all.
2021-09-13 08:50:32 +02:00
Jakub Zelenka 43f0141d74 Make OpenSSL tests less dependent on system config
It fixes dependencies on system config if running tests with OpenSSL 3.0
2021-09-12 20:30:02 +01:00
Kamil Tekiela d4ea11d0dc typo 2021-09-12 20:19:03 +01:00
Máté Kocsis ea9f943d33 Change gen-stub.php to gen_stub.php in help text 2021-09-12 17:09:56 +02:00
Máté Kocsis 73063db5c8 Fix documentation generation when legacy arginfo is generated
When legacy arginfo is generated, all the type info gets lost. Since this task is performed before any other additional functionalities of gen_stub.php (e.g. verification, method synopsis and class synopsis generation), these fail as they would require the missing type information.

The issue is fixed by deep cloning the file info objects (albeit only their affected properties), so that we use those for legacy arginfo generation, leaving the original ones untouched.
2021-09-12 11:42:22 +02:00