Commit Graph

16235 Commits

Author SHA1 Message Date
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
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
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
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
Nikita Popov
085e16c301 Fix signed integer overflow
Fixes oss-fuzz #26763.
2020-10-30 12:38:27 +01:00
Dmitry Stogov
6beb080a01 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed run-time binding of preloaded dynamically declared function
2020-10-28 13:51:17 +03:00
Dmitry Stogov
68f80be9d1 Fixed run-time binding of preloaded dynamically declared function 2020-10-28 13:50:14 +03:00
Nikita Popov
26bd857999 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Declare may_retry_reparse_point on windows only
2020-10-26 12:41:12 +01:00
Nikita Popov
31aca85572 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Declare may_retry_reparse_point on windows only
2020-10-26 12:40:56 +01:00
Nikita Popov
824cbc2781 Declare may_retry_reparse_point on windows only 2020-10-26 12:40:45 +01:00
Christoph M. Becker
0abcb9fb69 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fix #80258: Windows Deduplication Enabled, randon permission errors
2020-10-26 11:22:39 +01:00
Christoph M. Becker
ac2e9587fb Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #80258: Windows Deduplication Enabled, randon permission errors
2020-10-26 11:21:52 +01:00
Christoph M. Becker
848e24f24d Fix #80258: Windows Deduplication Enabled, randon permission errors
A recent bug fix regarding symlinks claimed:

> After resolving reparse points, the path still may be a reparse
> point; in that case we have to resolve that reparse point as well.

While that is basically correct, some reparse points may point to
inaccessible system folders (e.g. `IO_REPARSE_TAG_DEDUP` points to
"\System Volume Information").  Since we don't know details about
arbitrary reparse points, and are mainly interested in nested symlinks,
we take a step back, and only resolve `IO_REPARSE_TAG_SYMLINK` for now.

Close GH-6354.
2020-10-26 11:21:14 +01:00
Máté Kocsis
47bbfe1fc0
Require stubs to declare return types for magic methods when possible
Closes GH-6376
2020-10-23 16:33:16 +02:00
Nikita Popov
0fb2374e06 Make GC default threshold handling consistent
While the initial threshold is set to 10001 roots, the threshold
adjustment logic may then set it to 10000. The exact value really
doesn't matter, but we should make it consistent.
2020-10-23 10:30:07 +02:00
Nikita Popov
078df4d144 Don't allow passing unknown named params to class without ctor
See also https://externals.io/message/112083.

Closes GH-6364.
2020-10-23 09:46:55 +02:00
Máté Kocsis
a8e92e361f
Run arginfo/ZPP verification tests in strict mode as well
Closes GH-6370
2020-10-22 19:01:40 +02:00
Nikita Popov
dd4a080133 Simplify and fix generator tree management
This makes a number of related changes to the generator tree
management, that should hopefully make it easier to understand,
more robust and faster for the common linear-chain case. Fixes
https://bugs.php.net/bug.php?id=80240, which was the original
motivation here.

 * Generators now only add a ref to their direct parent.
 * Nodes only store their children, not their leafs, which avoids
   any need for leaf updating. This means it's no longer possible
   to fetch the child for a certain leaf, which is something we
   only needed in one place (update_current). If multi-children
   nodes are involved, this will require doing a walk in the other
   direction (from leaf to root). It does not affect the common
   case of single-child nodes.
 * The root/leaf pointers are now seen as a pair. One leaf generator
   can point to the current root. If a different leaf generator is
   used, we'll move the root pointer over to that one. Again, this
   is a cache to make the common linear chain case fast, trees may
   need to scan up the parent link.

Closes GH-6344.
2020-10-22 10:25:25 +02:00
Nikita Popov
d3812ca41b Fixed bug #80255
This was a copy&paste mistake, target_block was used where
follow_block was intended. Also update copy&paste mistakes in
the comments.
2020-10-19 15:13:53 +02:00
Nikita Popov
97202d9d84 Make sure output start filename is not freed early
As filenames are no longer interned, we need to keep a reference
to the zend_string to make sure it isn't freed.

To avoid a nominal source compatibility break, create a new member
in the globals.
2020-10-16 17:27:52 +02:00
Nikita Popov
28e21d80b0 Fix leak when setting dynamic property on generator 2020-10-16 16:58:27 +02:00
Nikita Popov
4ece62fba9 Fix bug #80055
We need to perform trait scope fixup for both methods involved
in the inheritance check. For that purpose we already need to
thread through a separate fn scope through the entire inheritance
checking machinery.
2020-10-15 14:24:25 +02:00
Nikita Popov
b2700811f3 Skip arginfo test under msan
Msan is missing interceptors for some functions that result in
false positives.
2020-10-15 10:40:23 +02:00
Nikita Popov
0832376411 More arginfo/zpp verification
Run all functions with a varying number of null arguments, which
helps us flush out all kinds of bugs.

Closes GH-5881.
2020-10-14 16:26:09 +02:00
Nikita Popov
1748b8111e Fix handling of throwing undef var in verify return
If we have an undefined variable and null is not accepted by the
return type, we want to throw just the undef var error.

In this case this lead to an infinite loop, because we overwrite
the exception opline in SAVE_OPLINE and it does not get reset
when chaining into a previous exception. Add an assertiong to
catch this case earlier.
2020-10-13 11:43:43 +02:00
Christoph M. Becker
2d01a89ad1 7.3.25 is next 2020-10-13 09:52:46 +02:00
Nikita Popov
f9b7609d17 Fixed bug #80225
Namespaced and declares have a different interpretation of what
"first statement" means.
2020-10-12 16:35:09 +02:00
Nikita Popov
66ecee6243 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Detect self-addition of array more accurately
  Deindirect source elements in zend_hash_merge
2020-10-12 11:25:27 +02:00
Nikita Popov
5a7f9afb99 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Detect self-addition of array more accurately
  Deindirect source elements in zend_hash_merge
2020-10-12 11:24:59 +02:00
Nikita Popov
3c4dd73c02 Detect self-addition of array more accurately
While the zvals may be different, they may still point to the
same array.

Fixes oss-fuzz #26245.
2020-10-12 11:24:31 +02:00
Nikita Popov
e304468e57 Deindirect source elements in zend_hash_merge
If the RHS has INDIRECT elements, we do not those to be added to
the LHS verbatim. As we're using UPDATE_INDIRECT, we might even
create a nested INDIRECT that way.

This is a side-quest of oss-fuzz #26245.
2020-10-12 11:24:27 +02:00
Nikita Popov
d953cd1862 Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Avoid non-object in FE_FREE
2020-10-12 09:46:38 +02:00
Nikita Popov
304141e8f8 Avoid non-object in FE_FREE
Even if the properties HT is empty, make sure we still leave an
object in the FE_RESET result, so our type inference results
stay correct.
2020-10-12 09:45:52 +02:00
Nikita Popov
623bf39e9c Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4:
  Fixed bug #80186
2020-10-09 17:02:20 +02:00
Nikita Popov
15443f8af4 Fixed bug #80186
Early exit in FE_RESET if get_properties() returns empty array,
as we cannot add HT iterators to zend_empty_array.
2020-10-09 16:56:08 +02:00
Nikita Popov
6188b7a1da Revert "Change calling convention of zval_update_constant[_ex]() to fastcall."
This reverts commit 5a447b086b.

Revert this ABI break from PHP-8.0, leaving it only on master.
2020-10-09 15:06:12 +02:00
Dmitry Stogov
5a447b086b Change calling convention of zval_update_constant[_ex]() to fastcall. 2020-10-08 02:04:38 +03:00
Dmitry Stogov
fd81e708bc Fixed incorrect behavior of observer API.
ZEND_HANDLE_EXCEPTION might call zend_observer_fcall_end() even if exception is cought by function. The fix moved zend_observer_fcall_end() into a right place and remove OBSERVER sepecialization for ZEND_HANDLE_EXCEPTION handler.
2020-10-07 17:06:53 +03:00
Nikita Popov
edf0c6a6ae Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #80194
2020-10-07 15:03:56 +02:00
Nikita Popov
683c988493 Fixed bug #80194
We should strip NOPs from unreachable_free blocks as well, to make
sure that the free really is the first op.
2020-10-07 15:03:12 +02:00
Nikita Popov
68195bd481 Update ext/spl parameter names
Closes GH-6284.
2020-10-07 12:26:46 +02:00
Nikita Popov
ec484a0788 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #80126
2020-10-06 16:34:02 +02:00