| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| |
| |
| |
| |
| | |
When retrieving the static class properties via reflection, we have to
cater to possible modifications.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Revert "Fix #79487: ::getStaticProperties() ignores property modifications"
|
| |
| |
| |
| | |
This reverts commit a895bb6885fbceea3e8375816969d5510d8d082e.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix #79487: ::getStaticProperties() ignores property modifications
|
| |
| |
| |
| |
| | |
When retrieving the static class properties via reflection, we have to
cater to possible modifications.
|
| |
| |
| |
| | |
Mostly reindent PHP scripts to spaces.
|
| |
| |
| |
| |
| | |
For the common ZVAL_OBJ + GC_ADDREF pattern.
This mirrors the existing ZVAL_STR_COPY API.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This adds the following APIs:
void zend_call_known_function(
zend_function *fn, zend_object *object, zend_class_entry *called_scope,
zval *retval_ptr, int param_count, zval *params);
void zend_call_known_instance_method(
zend_function *fn, zend_object *object, zval *retval_ptr, int param_count, zval *params);
void zend_call_known_instance_method_with_0_params(
zend_function *fn, zend_object *object, zval *retval_ptr);
void zend_call_known_instance_method_with_1_params(
zend_function *fn, zend_object *object, zval *retval_ptr, zval *param);
void zend_call_known_instance_method_with_2_params(
zend_function *fn, zend_object *object, zval *retval_ptr, zval *param1, zval *param2);
These are used to perform a call if you already have the
zend_function you want to call. zend_call_known_function()
is the base API, the rest are just really thin wrappers around
it for the common case of instance method calls.
Closes GH-5692.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This solves [#79628](https://bugs.php.net/79628).
Similar to `ReflectionClass::getMethods()` and `ReflectionClass::getProperties()`,
this new `$filter` argument allows the filtering of constants defined in a class by
their visibility.
For that, we create three new constants for `ReflectionClassConstant`:
* `IS_PUBLIC`
* `IS_PROTECTED`
* `IS_PRIVATE`
Closes GH-5649.
|
| |
| |
| |
| | |
Close GH-5675.
|
| |
| |
| |
| |
| |
| | |
RFC: https://wiki.php.net/rfc/constructor_promotion
Closes GH-5291.
|
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| |
| | |
Moreover, throw a more appropriate ValueError in case the integer
position provided is less than 0.
Closes GH-5513
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, disabling a function only replaces the internal
function handler with one that throws a warning, and a few
places in the engine special-case such functions, such as
function_exists. This leaves us with a Schrödinger's function,
which both does not exist (function_exists returns false) and
does exist (you cannot define a function with the same name).
In particular, this prevents the implementation of robust
polyfills, as reported in https://bugs.php.net/bug.php?id=79382:
if (!function_exists('getallheaders')) {
function getallheaders(...) { ... }
}
If getallheaders() is a disabled function, this code will break.
This patch changes disable_functions to remove the functions from
the function table completely. For all intents and purposes, it
will look like the function does not exist.
This also renders two bits of PHP functionality obsolete and thus
deprecated:
* ReflectionFunction::isDisabled(), as it will no longer be
possible to construct the ReflectionFunction of a disabled
function in the first place.
* get_defined_functions() with $exclude_disabled=false, as
get_defined_functions() now never returns disabled functions.
Fixed bug #79382.
Closes GH-5473.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is only used in reflection, where doing a simple string check
is acceptable.
I'm also dropping the "dtor" printing in the reflection dump.
Dtors are just one of many magic methods, I don't think there's
a point in explicitly highlighting them, when the name is already
unambiguous.
|
| |
| |
| |
| | |
Closes GH-5377
|
| |
| |
| |
| | |
Closes GH-5376
|
| |
| |
| |
| | |
Make this functionality available outside reflection.
|
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| | |
Instead fetch the name from the respective structure. The only
place where this is still used is ReflectionClassConst,
as zend_class_const does not store the name.
|
| |
| |
| |
| |
| |
| | |
Instead fetch the name from the function/class/property,
as appropriate. This makes us independent of the property,
and eliminates error conditions related to it.
|
| |
| |
| |
| |
| |
| | |
Directly fetch the name property, instead of construction the
properties hash table and performing a lookup in it. This is both
slow and wastes a lot of memory.
|
| | |
|
| |
| |
| |
| |
| | |
This really doesn't add anything, and only makes for confusing
terminology. Only marking properties as dynamic is sufficient.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Closes GH-5277
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| | |
|
| |
| |
| |
| |
| |
| | |
Make ReflectionClassConstant->class the declaring class, not the
class on which the constant was fetched. This matches the behavior
for properties and methods.
|
| |
| |
| |
| |
| |
| | |
Make ReflectionClass::getMethods() behave the same ways as
ReflectionClass::getProperties() by not including private methods
from parent classes.
|
| |
| |
| |
| | |
Closes GH-5188
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
Make sure we still perform a zpp check for the static case, and
also always enforce that the parameter is ?object. Otherwise we
violate the specified signature.
|
| |
| |
| |
| |
| | |
Where possible, the stub file should match the name of the C file,
so that the build system integration automatically recompiles it.
|
| | |
|
| | |
|
| | |
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #79115
|
| |\
| | |
| | |
| | |
| | | |
* PHP-7.3:
Fixed bug #79115
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of having a completely independent encoding for type list
entries. This is going to use more memory, but I'm not particularly
concerned about that, as type unions that contain multiple classes
should be uncommon. On the other hand, this allows us to treat
top-level types and types inside lists mostly the same.
A new ZEND_TYPE_FOREACH macros allows to transparently treat list
and non-list types the same way. I'm not using it everywhere it could be
used for now, just the places that seemed most obvious.
Of course, this will make any future type system changes much simpler,
as it will not be necessary to duplicate all logic two times.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | | |
In reflection, sodium, and SPL
|