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

722 Commits

Author SHA1 Message Date
Dmitry Stogov
fa7af81c22 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixed trampoline handling
2020-11-17 23:56:39 +03:00
Dmitry Stogov
9841e8e411 Fixed trampoline handling 2020-11-17 23:56:05 +03:00
Dmitry Stogov
849b9e2bcd Merge branch 'PHP-8.0'
* PHP-8.0:
  Trampoline cleanup
2020-11-16 12:06:09 +03:00
Dmitry Stogov
64dc79f906 Trampoline cleanup 2020-11-16 12:05:45 +03:00
Nikita Popov
4945bc2609 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix phi use chain management when renaming variable
2020-11-09 17:08:46 +01:00
Nikita Popov
523dd9a2d9 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix phi use chain management when renaming variable
2020-11-09 17:08:38 +01:00
Nikita Popov
d971b67027 Fix phi use chain management when renaming variable
If there is a previous use of the new variable in the phi, we need
to NULL out the use chain of the new source we're adding.

Test case is reduced from an assertion failure in the Symfony Demo.
2020-11-09 17:08:16 +01:00
Nikita Popov
6033c77653 Merge branch 'PHP-8.0'
* PHP-8.0:
  Skip preload test under asan
2020-11-09 09:47:12 +01:00
Nikita Popov
5df461bc91 Skip preload test under asan
Just like the other preload tests with startup failures, this may
cause leaks.
2020-11-09 09:46:48 +01:00
Nikita Popov
6808968c89 Backport preloading trait fixup fixes
This cherry-picks 33969c2252 and
2effbfd871 from PHP-8.0.

The issues these commits fix could also manifest in PHP 7.4, and
a commenter on bug #80307 reports this this might indeed be
happening.
2020-11-05 16:35:08 +01:00
Nikita Popov
046143859d Merge branch 'PHP-8.0'
* PHP-8.0:
  Fixup trait methods even if no traits are used
2020-11-05 13:16:31 +01:00
Nikita Popov
2effbfd871 Fixup trait methods even if no traits are used
Trait methods might be non-trivially inherited, in which case we
may have to perform fixup in classes that do not directly use any
traits.
2020-11-05 13:15:32 +01:00
Nikita Popov
1fea175765 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix multiple trait fixup
2020-11-05 12:11:20 +01:00
Nikita Popov
33969c2252 Fix multiple trait fixup
If a trait method is inherited, preloading trait fixup might be
performed on it multiple times. Usually this is fine, because
the opcodes pointer will have already been updated, and will thus
not be found in the xlat table.

However, it can happen that the new opcodes pointer is the same
as one of the old opcodes pointers, if the pointer has been reused
by the allocator. In this case we will look up the wrong op array
and overwrite the trait method with an unrelated trait method.

We fix this by indexing the xlat table not by the opcodes pointer,
but by the refcount pointer. The refcount pointer is not changed
during optimization, and accurately represents which op arrays
should use the same opcodes.

Fixes bug #80307. The test case does not reproduce the bug, because
this depends on a lot of "luck" with the allocator. The test case
merely illustrates a case where orig_op_array would have been NULL
in the original code.
2020-11-05 12:04:39 +01:00
Nikita Popov
c380812ed2 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix static variable in methods inheritance during preloading
2020-11-04 15:43:00 +01:00
Nikita Popov
670fe594b9 Fix static variable in methods inheritance during preloading
This is now "bug compatible" with the normal behavior, and more
imporantly, does not crash :)
2020-11-04 15:42:52 +01:00
Nikita Popov
6457043a75 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix dynamic function definition in preload script
2020-11-04 10:56:24 +01:00
Nikita Popov
c6563dddac Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix dynamic function definition in preload script
2020-11-04 10:55:59 +01:00
Nikita Popov
e0d6c3f7ba Fix dynamic function definition in preload script
We should use normal function renaming if the function is declared
during preloading itself, rather than afterwards.

This fixes a regression introduced by
68f80be9d1.
2020-11-04 10:54:08 +01:00
Nikita Popov
b43c455b98 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't disable early binding during preloading script
2020-11-03 16:47:42 +01:00
Nikita Popov
54668a449e Don't disable early binding during preloading script
We should only disable early binding during the opcache_compile_file()
calls, not inside the preloading script or anything it includes.
The right condition to check for is whether we compile the file
without execution, as declaring classes is "execution".
2020-11-03 16:45:13 +01:00
Nikita Popov
d0a07cd0fa Merge branch 'PHP-8.0'
* PHP-8.0:
  Report parse errors during preloading
2020-11-03 16:25:08 +01:00
Nikita Popov
b009573f4e Report parse errors during preloading 2020-11-03 16:24:54 +01:00
Nikita Popov
8d43896013 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix use of type copy ctor when importing trait properties
2020-11-03 15:30:00 +01:00
Nikita Popov
9fd8e00f1a Fix use of type copy ctor when importing trait properties
We shouldn't call the copy constructor inside the original type,
duh.
2020-11-03 15:29:18 +01:00
Nikita Popov
fa7272780b Merge branch 'PHP-8.0'
* PHP-8.0:
  Allow unlinked classes when performing in_compilation variance check
2020-11-03 14:50:15 +01:00
Nikita Popov
7e55317558 Allow unlinked classes when performing in_compilation variance check
As preloading runs in in_compilation mode, we also need to allow
use of unlinked classes in lookup_class().
2020-11-03 14:49:10 +01:00
Nikita Popov
b4b91a8240 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix variance checks on resolved union types
2020-11-03 14:19:53 +01:00
Nikita Popov
ee934f8245 Fix variance checks on resolved union types
This is a bit annoying: When preloading is used, types might be
resolved during inheritance checks, so we need to deal with CE
types rather than just NAME types everywhere.
2020-11-03 14:19:15 +01:00
Nikita Popov
fa15f03241 Merge branch 'PHP-8.0'
* PHP-8.0:
  Don't ignore internal classes during preloading
2020-11-03 11:51:29 +01:00
Nikita Popov
51b5f7d67d Don't ignore internal classes during preloading
When preloading, it's fine to make use of internal class information,
as we do not support Windows. It is also necessary to allow proper
variance checks against internal classes.
2020-11-03 11:50:14 +01:00
Nikita Popov
a600443190 Merge branch 'PHP-8.0'
* PHP-8.0:
  Fix persisting property info table with internal parent
2020-11-03 11:31:58 +01:00
Nikita Popov
14c42c6961 Fix persisting property info table with internal parent
If the property info comes from an internal parent, we won't have
an xlat entry for it. Leave it alone in that case.
2020-11-03 11:30:44 +01:00
Nikita Popov
ac5486b832 Merge branch 'PHP-8.0'
* PHP-8.0:
  Preserve trait method alias name during preloading
2020-11-03 10:57:01 +01:00
Nikita Popov
6f2431860b Preserve trait method alias name during preloading 2020-11-03 10:55:59 +01:00
Nikita Popov
1b3b430f47 Add --repeat testing mode
This testing mode executes the test multiple times in the same
process (but in different requests). It is primarily intended to
catch tracing JIT bugs, but also catches state leaks across
requests.

Closes GH-6365.
2020-10-30 17:29:33 +01:00
Dmitry Stogov
57a3fbb1e1 Fixed INIT_METHOD_CALL + IS_VAR + reference in tracing JIT 2020-09-22 00:47:23 +03:00
Dmitry Stogov
5a085777b7 Fixed incorrect JIT for FETCH_THIS+SEND_REF 2020-09-21 21:53:03 +03:00
Nikita Popov
edf22962ef Make constant redeclaration a warning
We missed the change to make this an Error exception in PHP 8,
but at least elevate it to a warning, to avoid a notice -> exception
jump at a later time.
2020-09-21 17:04:39 +02:00
Nikita Popov
c5401854fc Run tidy
This should fix most of the remaining issues with tabs and spaces
being mixed in tests.
2020-09-18 14:28:32 +02:00
Máté Kocsis
9975986b7e Improve error messages mentioning parameters instead of arguments
Closes GH-5999
2020-09-09 10:47:43 +02:00
Dmitry Stogov
c5b42be40e Fixed memory leak 2020-09-09 11:09:20 +03:00
Michael Voříšek
cb284f668c Fix typo in test description
Closes GH-6062.
2020-09-02 13:07:40 +02:00
Máté Kocsis
7aacc705d0 Add many missing closing PHP tags to tests
Closes GH-5958
2020-08-09 22:03:36 +02:00
Nikita Popov
c48b745f00 Promote "undefined array key" notice to warning
This implements the last remaining part of the
https://wiki.php.net/rfc/engine_warnings RFC.

Closes GH-5927.
2020-08-03 14:40:50 +02:00
Dmitry Stogov
41de27ecc2 Skip tests leaking because of preloading failure. 2020-07-30 14:04:14 +03:00
Dmitry Stogov
02fae1fc53 Fixed bug #79888 (Incorrect execution with JIT enabled) 2020-07-29 17:32:57 +03:00
George Peter Banyard
b2248789ed Implement 'Saner Numeric Strings' RFC:
RFC: https://wiki.php.net/rfc/saner-numeric-strings

This removes the -1 allow_error mode from is_numeric_string functions and replaces it by
a trailing boolean out argument to preserve BC in a couple of places.

Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit
a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError.

This mostly affects:
 - String offsets
 - Arithmetic operations
 - Bitwise operations

Closes GH-5762
2020-07-29 02:51:09 +01:00
Ilija Tovilo
9bf119832d Implement nullsafe ?-> operator
RFC: https://wiki.php.net/rfc/nullsafe_operator

Closes GH-5619.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2020-07-24 10:05:03 +02:00
Nikita Popov
f7f557926e Fix arg/func info
* mysqli_get_server_info() cannot return null. The underlying API
   is infallible.
 * mysqli_select_db() func info is redundant.
 * mb_detect_order() can only return array|true, not array|false.

Also make the func_info.phpt test that is supposed to catch these
kinds of issues actually work.
2020-07-21 15:00:33 +02:00