Commit Graph

121491 Commits

Author SHA1 Message Date
Derick Rethans
fe2cbcac70 Merge branch 'PHP-7.4' into PHP-8.0 2020-11-07 18:49:00 +00:00
Derick Rethans
25643b56a2 Update version in 7.4 branch 2020-11-07 18:48:13 +00:00
Christoph M. Becker
49ca191667 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Split tests for compatibility with ICU 68.1
2020-11-06 17:44:51 +01:00
Christoph M. Becker
77b6e95d92 Split tests for compatibility with ICU 68.1 2020-11-06 17:42:39 +01:00
Christoph M. Becker
d65a520b1d Raise E_WARNING on PHP related errors
If Zip operations fails due to PHP error conditions before libzip even
has been called, there is no meaningful indication what failed; the
functions just return false, and the Zip status indicated that no error
did occur.  Therefore we raise `E_WARNING` in these cases.

Closes GH-6356.
2020-11-06 11:00:43 +01:00
Dmitry Stogov
98e4f9466d Move stack overflow checks out of the loops 2020-11-06 12:09:56 +03:00
Remi Collet
e2509cf98a report about ZSTD compression availability 2020-11-06 09:58:08 +01:00
Remi Collet
8d7ca472e5 only display libzip both headers/library versions if they differ 2020-11-06 09:58:05 +01:00
Nikita Popov
2d894916c5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Backport preloading trait fixup fixes
2020-11-05 16:37:45 +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
Dmitry Stogov
ff91800602 Fixed incorrect invariant guard motion 2020-11-05 18:32:00 +03: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
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
7c7c6b0d73 End output handlers in preload shutdown
Same as in php_request_shutdown(), we need to end any active
output handlers, as these may no longer be safe to execute
lateron.
2020-11-04 16:05:24 +01:00
Nikita Popov
73321bc300 getlastmod() can return false
At least this can happen during preloading.
2020-11-04 15:53:08 +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
Christoph M. Becker
b8f2531ff0 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80266: parse_url silently drops port number 0
2020-11-04 14:57:17 +01:00
Christoph M. Becker
00e41a10b8 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80266: parse_url silently drops port number 0
2020-11-04 14:54:32 +01:00
Christoph M. Becker
2cab085bb3 Fix #80266: parse_url silently drops port number 0
As of commit 81b2f3e[1], `parse_url()` accepts URLs with a zero port,
but does not report that port, what is wrong in hindsight.

Since the port number is stored as `unsigned short` there is no way to
distinguish between port zero and no port.  For BC reasons, we thus
introduce `parse_url_ex2()` which accepts an output parameter that
allows that distinction, and use the new function to fix the behavior.

The introduction of `parse_url_ex2()` has been suggested by Nikita.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=81b2f3e5d9fcdffd87a4fcd12bd8c708a97091e1>

Closes GH-6399.
2020-11-04 14:53:19 +01:00
Nikita Popov
7794925ba4 Assert that references are not persisted
There should not be any need to persist references, and it's unlikely
that persisting a reference will behave correctly at runtime, because
we don't have a concept of an immutable reference.
2020-11-04 14:51:44 +01:00
Nikita Popov
57b0e5a045 Don't xfail method_static_var.phpt
Let's test the current behavior here. It might not be right, but
it's long-standing behavior.

Nearly missed an assertion failure here because the test was
XFAILed...
2020-11-04 12:30:41 +01:00
Nikita Popov
9ed2f4898b Don't disable opcache for generic tests
Even if the original issue only reproduces without opcache, we
should still allow running them with and without opcache.
2020-11-04 11:12:12 +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
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
b009573f4e Report parse errors during preloading 2020-11-03 16:24:54 +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
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
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
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
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
6f2431860b Preserve trait method alias name during preloading 2020-11-03 10:55:59 +01:00
Nikita Popov
53c417d81c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix another implicit function declaration in configure
2020-11-03 10:39:26 +01:00
Nikita Popov
4e68c53a21 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix another implicit function declaration in configure
2020-11-03 10:39:13 +01:00
Nikita Popov
00ba784a2c Fix another implicit function declaration in configure
As mentioned on bug #80171. This one is in libtool.m4, might get
lost on libtool updates.
2020-11-03 10:38:16 +01:00
Chris Brown
4d16d3cc38 Fix typo in UPGRADING
Closes GH-6395.
2020-11-03 09:35:02 +01:00
Bogdan Ungureanu
6d6fadeb0d Improved error message for typed class properties with null as default value
Closes GH-6396.
2020-11-03 09:28:53 +01:00
Chris Brown
94938e4ee7 [ci skip] Fix small typo
`as` -> `was`

Closes GH-6394.
2020-11-02 18:11:13 +01:00
Nikita Popov
0571f09424 Rename opcache.jit_max_loops_unroll to opcache.jit_max_loop_unrolls 2020-11-02 12:25:21 +01:00
Christoph M. Becker
6fc2cab254 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #70461: disable md5 code when it is not supported in net-snmp
2020-11-02 11:41:37 +01:00
Christoph M. Becker
0123f75b5d Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #70461: disable md5 code when it is not supported in net-snmp
2020-11-02 11:39:42 +01:00
Christoph M. Becker
9690ded288 Fix #70461: disable md5 code when it is not supported in net-snmp
Patch contributed by Alexander Bergmann.

Closes GH-6389.
2020-11-02 11:36:26 +01:00
Dharman
cf38a6f51f Fix tests for MariaDB
Closes GH-6390.
2020-11-02 09:58:46 +01:00
Alex Dowad
526c624dc4 Fix test added in d44235acae 2020-10-30 22:11:27 +02:00
Alex Dowad
d44235acae Convert numeric string array keys to integers correctly in JITted code
While fixing bugs in mbstring, one of my new test cases failed with a strange
error message stating: 'Warning: Undefined array key 1...', when clearly the
array key had been set properly.

GDB'd that sucker and found that JIT'd PHP code was calling directly into
`zend_hash_add_new` (which was not converting the numeric string key to an
integer properly). But where was that code coming from? I examined the disasm,
looked up symbols to figure out where call instructions were going, then grepped
the codebase for those function names. It soon became clear that the disasm I
was looking at was compiled from `zend_jit_fetch_dim_w_helper`.
2020-10-30 22:07:08 +02:00
Nikita Popov
904c1b6589 FIxed bug #80299
The must_wrap was leaking across iterations.
2020-10-30 17:23:18 +01:00
Nikita Popov
5958137dc5 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix SSA integrity violation for type inference in dead code
2020-10-30 15:52:46 +01:00
Nikita Popov
83738281eb Fix SSA integrity violation for type inference in dead code
The foreach body can never be executed and thus may contain empty
types. We should still uphold our SSA integrity invariants in that
case.
2020-10-30 15:52:10 +01:00
Christoph M. Becker
72d9d9b88f Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix bug79177.phpt wrt. JIT
2020-10-30 15:49:48 +01:00
Christoph M. Becker
0427dcb913 Fix bug79177.phpt wrt. JIT
JIT ignores that the `zend_write` callback is overwritten, so we define
our own callback and caller.

We also fix the "inconsistent DLL binding" warnings on Windows, by
introducing `PHP_ZEND_TEST_API`.

Closes GH-6391.
2020-10-30 15:47:18 +01:00