summaryrefslogtreecommitdiff
path: root/ext/reflection/php_reflection.c
Commit message (Collapse)AuthorAgeFilesLines
* Implement enumsIlija Tovilo2021-03-171-3/+252
| | | | | | | | RFC: https://wiki.php.net/rfc/enumerations Co-authored-by: Nikita Popov <nikita.ppv@gmail.com> Closes GH-6489.
* Merge branch 'PHP-8.0'Felipe Pena2021-02-251-0/+9
|\
| * Merge branch 'PHP-7.4' into PHP-8.0Felipe Pena2021-02-251-0/+9
| |\
| | * Fix memleak on ReflectionFunction and ReflectionGenerator classes when ↵Felipe Pena2021-02-251-0/+9
| | | | | | | | | | | | calling __construct after instantiation
* | | Fix static variable behavior with inheritanceNikita Popov2021-02-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Generate class entries from stubs for phar, posix, pspell, readline, ↵Máté Kocsis2021-02-151-89/+43
| | | | | | | | | | | | | | | | | | reflection, session, shmop Closes GH-6692
* | | Added Inheritance Cache.Dmitry Stogov2021-02-091-9/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Avoid modification of trait infoDmitry Stogov2021-01-191-2/+23
| | |
* | | Replace zend_bool uses with boolNikita Popov2021-01-151-23/+23
|/ / | | | | | | | | | | | | 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.
* | Fix buildChristoph M. Becker2021-01-011-1/+1
| | | | | | | | We cannot `RETURN_THROWS()` here, since `return_value` is not defined.
* | Use RETURN_THROWS() in a few placesMáté Kocsis2021-01-011-3/+3
| |
* | Fix ReflectionClass::getConstants() stubChristoph M. Becker2021-01-011-2/+1
| | | | | | | | | | | | | | If `zval_update_constant_ex()` fails, an exception has already been thrown, so we clarify that in the implementation as well. Closes GH-6557.
* | Merge branch 'PHP-7.4' into PHP-8.0Nikita Popov2020-11-241-2/+2
|\ \ | |/ | | | | | | * PHP-7.4: Fix usage of casted string in ReflectionParameter ctor
| * Fix usage of casted string in ReflectionParameter ctorNikita Popov2020-11-241-2/+2
| | | | | | | | Fixes oss-fuzz #27755.
* | Fixed bug #80370: Segmentation fault reflecting attributes of dynamic propertyBenjamin Eberlei2020-11-171-0/+4
| | | | | | | | Closes GH-6428.
* | Fix reflection getDefaultValue() with user arg infoNikita Popov2020-11-121-1/+6
| | | | | | | | | | The default value is part of the op_array in that case, but we have no way to access it. Fail gracefully.
* | Revert "Make ReflectionUnionType final"Nikita Popov2020-10-261-1/+0
| | | | | | | | | | | | | | This reverts commit ef6adb4e27853eb19bf50bad6486311920d6af7b. Per Ondrej's comment, this is already being used by BetterReflection adaptors, ugh.
* | Make ReflectionUnionType finalMáté Kocsis2020-10-251-0/+1
| | | | | | | | Closes GH-6384
* | don't display default value for variadicRemi Collet2020-10-071-1/+1
| |
* | Fixed bug #80190Nikita Popov2020-10-061-0/+3
| |
* | Make the $filter parameter of ReflectionClass::get*Constants() nullableMáté Kocsis2020-09-291-6/+16
| |
* | Honor strict_types=1 for attributes, improve backtracesNikita Popov2020-09-271-15/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make ReflectionAttribute::newInstance() respect the strict_types=1 declaration at the attribute use-site. More generally, pretend that we are calling the attribute constructor from the place where the attribute is used, which also means that the attribute location will show up properly in backtraces and inside "called in" error information. This requires us to store the attributes strict_types scope (as flags), as well as the attribute line number. The attribute filename can be recovered from the symbol it is used on. We might want to expose the attribute line number via reflection as well. See also https://externals.io/message/111915. Closes GH-6201.
* | Consolidate the usage of "either" and "one of" in error messagesMáté Kocsis2020-09-201-1/+1
| | | | | | | | Closes GH-6173
* | Check `ReflectionReference::fromArrayElement` with union typesGabriel Caruso2020-09-151-10/+10
| | | | | | | | | | | | | | ReflectionReference::fromArrayElement(array $array, int|string $key): ?ReflectionReference is going to be its official signature for PHP 8.0. Closes GH-5651
* | Consolidate new union type ZPP macro namesMáté Kocsis2020-09-111-7/+7
| | | | | | | | | | | | | | They will now follow the canonical order of types. Older macros are left intact due to maintaining BC. Closes GH-6112
* | Refactor ReflectionMethod::__construct()Máté Kocsis2020-09-111-53/+55
| | | | | | | | Closes GH-6098
* | Use ZPP instead of custom type checksMáté Kocsis2020-09-041-13/+10
| | | | | | | | We can add these types as a native type declaration to stubs as a side-effect. Closes GH-6068
* | Merge branch 'PHP-7.4'Nikita Popov2020-08-311-0/+1
|\ \ | |/ | | | | | | * PHP-7.4: Fix leak on consteval exception in ReflectionClass::__toString()
| * Fix leak on consteval exception in ReflectionClass::__toString()Nikita Popov2020-08-311-0/+1
| |
* | Merge branch 'PHP-7.4'Nikita Popov2020-08-311-1/+4
|\ \ | |/ | | | | | | * PHP-7.4: Check update constant failure in ReflectionClassConstant::__toString()
| * Check update constant failure in ReflectionClassConstant::__toString()Nikita Popov2020-08-311-1/+4
| |
| * Fixed bug #79820Christopher Broadbent2020-07-151-0/+17
| | | | | | | | | | | | | | | | | | Similar to what is done for ReflectionType itself, copy the type name stored inside ReflectionProperty. Also make sure the type field is always initialized for dynamic properties. This is a non-issue in PHP 8, because we store a pointer to the property_info there, rather than a copy.
* | Fix fetching default value of internal function with userland arginfoNikita Popov2020-08-311-1/+4
| | | | | | | | | | | | "Fix" in the sense of "not crash". We aren't able to actually display the default value for this case, as there's no way to fetch the relevant information right now.
* | Accept zend_object* in zend_update_propertyNikita Popov2020-08-071-1/+1
| |
* | Accept zend_object in zend_read_propertyNikita Popov2020-08-071-1/+1
| |
* | Get rid of empty function entriesMáté Kocsis2020-08-011-5/+1
| | | | | | | | Closes GH-5917
* | Implement named parametersNikita Popov2020-07-311-106/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From an engine perspective, named parameters mainly add three concepts: * The SEND_* opcodes now accept a CONST op2, which is the argument name. For now, it is looked up by linear scan and runtime cached. * This may leave UNDEF arguments on the stack. To avoid having to deal with them in other places, a CHECK_UNDEF_ARGS opcode is used to either replace them with defaults, or error. * For variadic functions, EX(extra_named_params) are collected and need to be freed based on ZEND_CALL_HAS_EXTRA_NAMED_PARAMS. RFC: https://wiki.php.net/rfc/named_params Closes GH-5357.
* | Add missing RETURN_THROWS()Máté Kocsis2020-07-301-0/+1
| |
* | Add a few missing parameter types in stubsMáté Kocsis2020-07-301-3/+7
| | | | | | | | Related to GH-5627
* | Cleanup argument handling in ext/reflectionMáté Kocsis2020-07-241-116/+83
| | | | | | | | Closes GH-5850
* | Make ReflectionGenerator finalNikita Popov2020-07-211-0/+1
| | | | | | | | This class is not safe against malicious extension / instantiation.
* | Review the usage of apostrophes in error messagesMáté Kocsis2020-07-101-28/+27
| | | | | | | | Closes GH-5590
* | Remove no_separation flagNikita Popov2020-07-071-3/+0
| |
* | Remove proto comments from C filesMax Semenik2020-07-061-387/+197
| | | | | | | | Closes GH-5758
* | Use zend_string_equals API in a couple placesNikita Popov2020-07-031-2/+1
| |
* | Fix leak in isDefaultValueAvailable()Nikita Popov2020-06-301-2/+3
| | | | | | | | Exposed in Symfony due to exit changes.
* | Implement Attribute Amendments.Martin Schröder2020-06-291-23/+88
| | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/attribute_amendments Support for attribute grouping is left out, because the short attribute syntax RFC will likely make it obsolete. Closes GH-5751.
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-06-241-3/+11
|\ \ | |/ | | | | | | * PHP-7.4: Fix #69804: ::getStaticPropertyValue() throws on protected props
| * Fix #69804: ::getStaticPropertyValue() throws on protected propsChristoph M. Becker2020-06-241-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | `ReflectionClass` allows reading of the values of private and protected constants, and also to get private and protected static methods. Therefore getting the values of private and protected static properties is also permissible, especially since `::getStaticProperties()` already allows to do so. We also allow ::setStaticPropertyValue() to modify private and protected properties, because otherwise this method is useless, as modifying public properties can be done directly.
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-06-241-4/+31
|\ \ | |/ | | | | | | * PHP-7.4: Fix #79487: ::getStaticProperties() ignores property modifications