| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
The unmangled name is already available as the hashtable key,
use it directly.
|
|
|
|
| |
Fixes oss-fuzz #31983.
|
|
|
|
|
|
|
|
| |
RFC: https://wiki.php.net/rfc/enumerations
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Closes GH-6489.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a method is inherited, the static variables will now always
use the initial values, rather than the values at the time of
inheritance. As such, behavior no longer depends on whether
inheritance happens before or after a method has been called.
This is implemented by always keeping static_variables as the
original values, and static_variables_ptr as the modified copy.
Closes GH-6705.
|
| |
|
|
|
|
| |
argument/result type checks
|
|
|
|
|
|
|
|
|
|
| |
This is a new transparent technology that eliminates overhead of PHP class inheritance.
PHP classes are compiled and cached (by opcahce) separately, however their "linking" was done at run-time - on each request. The process of "linking" may involve a number of compatibility checks and borrowing methods/properties/constants form parent and traits. This takes significant time, but the result is the same on each request.
Inheritance Cache performs "linking" for unique set of all the depending classes (parent, interfaces, traits, property types, method types involved into compatibility checks) once and stores result in opcache shared memory. As a part of the this patch, I removed limitations for immutable classes (unresolved constants, typed properties and covariant type checks). So now all classes stored in opcache are "immutable". They may be lazily loaded into process memory, if necessary, but this usually occurs just once (on first linking).
The patch shows 8% improvement on Symphony "Hello World" app.
|
|
|
|
| |
copying and desrpoying of immutable data.
|
| |
|
|
|
|
|
|
|
| |
We're starting to see a mix between uses of zend_bool and bool.
Replace all usages with the standard bool type everywhere.
Of course, zend_bool is retained as an alias.
|
|
|
|
|
|
|
| |
I suspect this is only a partial fix for the issue, it's probably
possible to recurse through a more complex pathway as well.
Fixes oss-fuzz #28961.
|
|
|
|
|
| |
Iterable was not considered a subtype of array|object, and thus
also not a subtype of mixed.
|
|
|
|
|
| |
This is now "bug compatible" with the normal behavior, and more
imporantly, does not crash :)
|
|
|
|
|
| |
We shouldn't call the copy constructor inside the original type,
duh.
|
|
|
|
|
| |
As preloading runs in in_compilation mode, we also need to allow
use of unlinked classes in lookup_class().
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| |
| |
| | |
* PHP-7.4:
Fix bug #80126
|
| |
| |
| |
| |
| |
| | |
When performing an unlinked instanceof, we also need to consider
interfaces of parent classes, as they may not have been inherited
yet.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Voidification of Zend API which always succeeded
Use bool argument types instead of int for boolean arguments
Use bool return type for functions which return true/false (1/0)
Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics
Closes GH-6002
|
| |
| |
| |
| | |
This was repeated three times.
|
| |
| |
| |
| | |
Closes GH-5401
|
| |
| |
| |
| |
| | |
We should use these cache slots for the new object serialization
mechanism rather than the old one.
|
| |
| |
| |
| |
| | |
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce
`ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)`
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds. This may be useful for other compilers as well.
[1] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019>
|
| |
| |
| |
| | |
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
|
| |
| |
| |
| |
| |
| |
| | |
RFC: https://wiki.php.net/rfc/mixed_type_v2
Closes GH-5313
Co-authored-by: Dan Ackroyd <danack@basereality.com>
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #79548
|
| |
| |
| |
| |
| | |
When duplicating user functions with static variables, make sure
that we init a new map ptr slot for the static variables.
|
| |
| |
| |
| |
| |
| |
| | |
If we're validating a class method against a trait method, we need
to treat "self" in the trait method as the class where the method
is used. To achieve this, we need to thread the proto scope through
all methods, so it can be provided separately from proto.common->scope.
|
| |
| |
| |
| | |
Closes GH-5361
|
| |
| |
| |
| |
| |
| |
| | |
Closes GH-5353. From now on, PHP will have reflection information
about default values of parameters of internal functions.
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
|
| | |
|
| |
| |
| |
| |
| |
| | |
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation
Closes GH-5068.
|
| |
| |
| |
| |
| |
| | |
I don't think there is any reason to disable this anymore,
at least all the messages generated in tests look correct and
more useful.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, when writing something like
class X {
use T1, T2 {
func as otherFunc;
}
function func() {}
}
where both T1::func() and T2::func() exist, we will simply assume
that func refers to T1::func(). This is surprising, and it doesn't
really make sense that this particular method gets picked.
This commit validates that non-absolute method references are
unambiguous, i.e. refer to exactly one method. If there is
ambiguity, it is required to write T1::func as otherFunc or
similar.
Closes GH-5232.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The place where interface implementation handlers is called is
currently ill-defined: If the class implements interfaces itself,
the handlers for both the parent interfaces and the new interfaces
will be called after all methods are registered (post trait use).
If the class does not implement interfaces, then the parent
interface handlers are called early during inheritance (before
methods are inherited).
This commit moves the calls to always occur after all methods are
available. For userland classes this will be post trait import,
at the time where interfaces get implemented (whether the class
itself defines additional interfaces or not). For internal classes
it will be at the end of inheritance, as internal class declarations
do not have proper finalization.
This allows us to simplify the logic for implementing the magic
Iterator / IteratorAggregate interfaces. In particularly we can
now also automatically detect whether an extension of
IteratorAggregate can safely reuse a custom get_iterator handler,
or whether it needs to switch to the userland mechanism. The
Iterator case continues to rely on ZEND_ACC_REUSE_GET_ITERATOR
for this purpose, as a wholesale replacement is not possible there.
|
| |
| |
| |
| |
| |
| |
| | |
I found what the modifier code does with XOR pretty confusing.
It's just removing the PPP bits...
Also remove an outdated reference to OVERLOADED_FUNCTION.
|
| |
| |
| |
| |
| |
| | |
Make sure all trait method references are converted to absolute
method references in advance. This regresses one error message
that I don't think is particularly valuable.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, trait methods are aliased will continue to use the
original function name. In a few places in the codebase, we will
try to look up the actual method name instead. However, this does
not work if an aliased method is used indirectly
(https://bugs.php.net/bug.php?id=69180).
I think it would be better to instead actually change the method
name to the alias. This is in principle easy: We have to allow
function_name to be changed even if op array is otherwise shared
(similar to static_variables). This means we need to addref/release
the function_name separately, but I don't think there is a
performance concern here (especially as everything is usually
interned).
There is a bit of complication in opcache, where we need to make
sure that the function name is released the correct number of times
(interning may overwrite the name in the original op_array, but we
need to release it as many times as the op_array is shared).
Fixes bug #69180.
Fixes bug #74939.
Closes GH-5226.
|
| | |
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
RFC: https://wiki.php.net/rfc/static_return_type
The "static" type is represented as MAY_BE_STATIC, rather than
a class type like "self" and "parent", as it has special
resolution semantics, and cannot be cached in the runtime cache.
Closes GH-5062.
|
| |
| |
| |
| |
| |
| |
| | |
This is equivalent to checking ce->num_interfaces. The only subtle
moment is during inheritance, where num_interface may change when
parent interfaces are inherited. The check in zend_do_link_class
thus uses "interfaces", not "ce->num_interfaces".
|
| |
| |
| |
| | |
This is equivalent to checking ce->num_traits.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix copying of functions in variance obligations
|
| |
| |
| |
| | |
Only copy sizeof(zend_internal_function) for internal functions.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #78989
|