Commit Graph

964 Commits

Author SHA1 Message Date
Nikita Popov
edace5f5e0 Merge branch 'PHP-7.4' 2019-10-01 13:05:12 +02:00
Nikita Popov
f2e8851245 Remove func copy optimization for private method with static vars
Not NULLing the static_variables pointer for shadow methods during
static var shutdown would be a way to avoid this leak, but unless
there's evidence that inherited private methods with static vars are
actually a common use-case, I don't think we should keep this kind
of fragile edge-case optimization.

Fixes OSS-Fuzz #17875.
2019-10-01 13:04:06 +02:00
Nikita Popov
f61f122b9a Merge branch 'PHP-7.4' 2019-09-12 16:41:45 +02:00
Nikita Popov
4b9ebd837b Allow throwing exception while loading parent class
This is a fix for symfony/symfony#32995.

The behavior is:

* Throwing exception when loading parent/interface is allowed
  (and we will also throw one if the class is simply not found).
* If this happens, the bucket key for the class is reset, so
  it's possibly to try registering the same class again.
* However, if the class has already been used due to a variance
  obligation, the exception is upgraded to a fatal error, as we
  cannot safely unregister the class stub anymore.
2019-09-12 16:41:18 +02:00
Nikita Popov
403396e42c Merge branch 'PHP-7.4' 2019-09-11 16:30:59 +02:00
Nikita Popov
270e5e3c5b Only allow "nearly linked" classes for parent/interface
The requirements for parent/interface are difference than for the
variance checks in type declarations. The latter can work on fully
unlinked classes, but the former need inheritance to be essentially
finished, only variance checks may still be outstanding.

Adding a new flag for this because we have lots of space, but we
could also represent these "inheritance states" more compactly in
the future.
2019-09-11 16:27:28 +02:00
Nikita Popov
ad661375e8 Merge branch 'PHP-7.4' 2019-08-28 17:36:31 +02:00
Nikita Popov
f912445eb2 Add missed mutability check 2019-08-28 17:35:25 +02:00
Nikita Popov
6323c13e74 Merge branch 'PHP-7.4' 2019-08-28 17:04:55 +02:00
Nikita Popov
2709d6a250 Destroy error handlers before final GC run 2019-08-28 17:04:35 +02:00
Nikita Popov
3f339ec15f Merge branch 'PHP-7.4' 2019-08-28 12:32:22 +02:00
Nikita Popov
ec9a96dc60 Fixed bug #78335
Destroy static properties and variables prior to the final GC run,
as they may hold GC roots.
2019-08-28 12:32:06 +02:00
Nikita Popov
1a9a5f995c Merge branch 'PHP-7.4' 2019-08-12 10:45:43 +02:00
Nikita Popov
a18ad194c4 Fixed bug #78396 2019-08-12 10:45:13 +02:00
Nikita Popov
105300afe4 Merge branch 'PHP-7.4' 2019-07-03 11:00:23 +02:00
Nikita Popov
2bf880db2c Fixed bug #78239 2019-07-03 11:00:12 +02:00
Nikita Popov
22ce77f500 Merge branch 'PHP-7.4' 2019-07-01 12:47:49 +02:00
Nikita Popov
01e1e1991d Clarify #if indentation in time limit implemementation 2019-07-01 12:18:21 +02:00
Dmitry Stogov
696b9e25c8 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed use-after-free
2019-06-28 10:44:13 +03:00
Dmitry Stogov
ba8033feb0 Fixed use-after-free 2019-06-28 10:43:56 +03:00
Nikita Popov
6aaab9adf7 Merge branch 'PHP-7.4' 2019-06-20 16:24:31 +02:00
Nikita Popov
eaafb69eea Change indexing scheme for symtable_cache
symtable_cache_ptr now points to the first unused symtable_cache
entry, rahter than the last used one. This avoids taking a pointer
to the minus first element of the array, which is UB. Instead we
take a pointer to the end plus one, which is not UB.
2019-06-20 16:21:39 +02:00
twosee
61f78de486 Constify some char* arguments or return values of ZEND_API
Closes GH-4247.
2019-06-12 16:49:32 +02:00
Nikita Popov
e4fae9c061 Merge branch 'PHP-7.4' 2019-06-11 13:16:38 +02:00
Nikita Popov
8f8fcbbd39 Support full variance if autoloading is used
Keep track of delayed variance obligations and check them after
linking a class is otherwise finished. Obligations may either be
unresolved method compatibility (because the necessecary classes
aren't available yet) or open parent/interface dependencies. The
latter occur because we allow the use of not fully linked classes
as parents/interfaces now.

An important aspect of the implementation is we do not require
classes involved in variance checks to be fully linked in order for
the class to be fully linked. Because the involved types do have to
exist in the class table (as partially linked classes) and we do
check these for correct variance, we have the guarantee that either
those classes will successfully link lateron or generate an error,
but there is no way to actually use them until that point and as
such no possibility of violating the variance contract. This is
important because it ensures that a class declaration always either
errors or will produce an immediately usable class afterwards --
there are no cases where the finalization of the class declaration
has to be delayed until a later time, as earlier variants of this
patch did.

Because variance checks deal with classes in various stages of
linking, we need to use a special instanceof implementation that
supports this, and also introduce finer-grained flags that tell us
which parts have been linked already and which haven't.

Class autoloading for variance checks is delayed into a separate
stage after the class is otherwise linked and before delayed
variance obligations are processed. This separation is needed to
handle cases like A extends B extends C, where B is the autoload
root, but C is required to check variance. This could end up
loading C while the class structure of B is in an inconsistent
state.
2019-06-11 13:09:33 +02:00
Dmitry Stogov
b4a3b49eab Merge branch 'PHP-7.4'
* PHP-7.4:
  Better hot/cold code splitting
2019-05-31 12:22:08 +03:00
Dmitry Stogov
1df9f238fe Better hot/cold code splitting 2019-05-31 12:20:21 +03:00
Dmitry Stogov
6d89553c48 Merge branch 'PHP-7.4'
* PHP-7.4:
  Mark "cold" functions
2019-05-29 11:50:27 +03:00
Dmitry Stogov
e14d77335c Mark "cold" functions 2019-05-29 11:48:41 +03:00
Nikita Popov
13f675b858 Merge branch 'PHP-7.4' 2019-05-27 09:38:33 +02:00
Nikita Popov
e6fac86dc3 Accept flags argument in zend_lookup_class_ex()
Instead of a single boolean, so we have space for extension here.
2019-05-27 09:36:25 +02:00
Nikita Popov
c3ee12e786 Merge branch 'PHP-7.4' 2019-05-23 10:41:27 +02:00
Nikita Popov
64918c7702 Forbid use of not fully linked classes 2019-05-23 10:41:10 +02:00
Nikita Popov
5063a7085c Merge branch 'PHP-7.4' 2019-05-15 12:49:50 +02:00
Nikita Popov
c666f6ec3b Merge branch 'PHP-7.3' into PHP-7.4 2019-05-15 12:49:03 +02:00
Nikita Popov
5846119e50 Merge branch 'PHP-7.2' into PHP-7.3 2019-05-15 12:48:35 +02:00
Nikita Popov
35353dc49a Fixed bug #76980
If we perform a class fetch that is not marked as exception safe,
convert exceptions thrown by autoloaders into a fatal error.

Ideally fetching the interfaces would be exception safe, but as it
isn't right now, we must abort at this point.
2019-05-15 12:46:23 +02:00
Dmitry Stogov
ba12a1bea9 Merge branch 'PHP-7.4'
* PHP-7.4:
  execute_data->return_value is not used for internal functions
2019-04-16 00:09:08 +03:00
Dmitry Stogov
3f7bf35e16 execute_data->return_value is not used for internal functions 2019-04-16 00:08:16 +03:00
Dmitry Stogov
55cc280429 Backported call frame initialization improvement 2019-04-12 02:35:42 +03:00
Nikita Popov
76f0ad3ade Merge branch 'PHP-7.4' 2019-04-11 12:23:03 +02:00
Nikita Popov
d087a356fe Suppress warnings using zend_quiet_write 2019-04-11 12:22:52 +02:00
Dmitry Stogov
cc900edd77 Simplify call frame initialization 2019-04-11 02:08:32 +03:00
Dmitry Stogov
f53240dbc4 Use fastcall calling convention 2019-04-02 23:49:13 +03:00
Dmitry Stogov
803d322240 Use fastcall calling convention 2019-04-02 22:10:57 +03:00
Joe Watkins
99230784f5
Merge branch 'PHP-7.4'
* PHP-7.4:
  zend_weakrefs
2019-03-12 00:37:28 +01:00
Joe Watkins
6529d7acd9
zend_weakrefs 2019-03-12 00:35:35 +01:00
Anatol Belski
571509f880 Merge branch 'PHP-7.4'
* PHP-7.4:
  Change the way timer queue timer is deleted
2019-02-12 18:38:15 -08:00
Anatol Belski
4f4cf9874d Change the way timer queue timer is deleted
As discussed in bug #77580, passing INVALID_HANDLE_VALUE for the
completion event improves compatibility with Wine/ReactOS. The timer
callback itself is supposed to complete fast enough, no behavior change
is to expect.
2019-02-12 18:30:55 -08:00
Dmitry Stogov
f45e0ce928 Remove ZEND_OVERLOADED_FUNCTION and corresponding call_method object handler 2019-02-07 21:05:46 +03:00