summaryrefslogtreecommitdiff
path: root/ext/reflection
Commit message (Collapse)AuthorAgeFilesLines
...
* | Ensure correct signatures for magic methodsGabriel Caruso2020-08-021-0/+60
| |
* | 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-304-19/+21
| | | | | | | | Related to GH-5627
* | Implement 'Saner Numeric Strings' RFC:George Peter Banyard2020-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/saner-numeric-strings This removes the -1 allow_error mode from is_numeric_string functions and replaces it by a trailing boolean out argument to preserve BC in a couple of places. Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError. This mostly affects: - String offsets - Arithmetic operations - Bitwise operations Closes GH-5762
* | Another pass of improving ext/date argument namesDerick Rethans2020-07-261-2/+2
| |
* | Cleanup argument handling in ext/reflectionMáté Kocsis2020-07-2413-245/+201
| | | | | | | | Closes GH-5850
* | More consistent parameter names for date/time functionsDerick Rethans2020-07-241-1/+1
| |
* | Improved number to string comparison semanticsNikita Popov2020-07-221-4/+3
| | | | | | | | | | | | RFC: https://wiki.php.net/rfc/string_to_number_comparison Closes GH-3886.
* | Make ReflectionGenerator finalNikita Popov2020-07-213-2/+3
| | | | | | | | This class is not safe against malicious extension / instantiation.
* | Preserve original ce_flags when registering classNikita Popov2020-07-201-0/+10
| | | | | | | | | | | | Bug that regularly sneaks in: ZEND_ACC_FINAL is set before calling zend_register_internal_class() and promptly gets ignored. Remove this footgun by preserving flags from the original CE.
* | Fix tests I missed beforeNikita Popov2020-07-201-1/+1
| |
* | Merge branch 'PHP-7.4'Nikita Popov2020-07-151-0/+22
|\ \ | |/ | | | | | | * PHP-7.4: Fixed bug #79820
| * Fixed bug #79820Christopher Broadbent2020-07-152-0/+39
| | | | | | | | | | | | | | | | | | 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.
* | Improve output of tokens in Parse ErrorsRowan Tommins2020-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, unexpected tokens in the parser are shown as the text found, plus the internal token name, including the notorious "unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)". This commit replaces that with a more user-friendly format, with two main types of token: * Tokens which always represent the same text are shown like 'unexpected token "::"' and 'expected "::"' * Tokens which have variable text are given a user-friendly name, and show like 'unexpected identifier "foo"', and 'expected identifer'. A few tokens have special cases: * unexpected token """ -> unexpected double-quote mark * unexpected quoted string "'foo'" -> unexpected single-quoted string "foo" * unexpected quoted string ""foo"" -> unexpected double-quoted string "foo" * unexpected illegal character "_" -> unexpected character 0xNN (where _ is almost certainly a control character, and NN is the hexadecimal value of the byte) The \ token has a special case in the implementation just to stop bison making a mess of escaping it and it coming out as \\
* | Review the usage of apostrophes in error messagesMáté Kocsis2020-07-1032-138/+136
| | | | | | | | 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
* | ReflectionMethod::invoke() object is not optionalNikita Popov2020-07-062-4/+4
| |
* | Use zend_string_equals API in a couple placesNikita Popov2020-07-031-2/+1
| |
* | Fix leak in isDefaultValueAvailable()Nikita Popov2020-06-302-2/+25
| | | | | | | | Exposed in Symfony due to exit changes.
* | Replace EXPECTF when possibleFabien Villepinte2020-06-291-1/+1
| | | | | | | | Closes GH-5779
* | Implement Attribute Amendments.Martin Schröder2020-06-293-24/+100
| | | | | | | | | | | | | | | | | | 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.
* | Remove unnecessary PHPDoc-alike blocks from testsMáté Kocsis2020-06-243-18/+0
| | | | | | | | Closes GH-5759
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-06-244-37/+81
|\ \ | |/ | | | | | | * PHP-7.4: Fix #69804: ::getStaticPropertyValue() throws on protected props
| * Fix #69804: ::getStaticPropertyValue() throws on protected propsChristoph M. Becker2020-06-244-37/+81
| | | | | | | | | | | | | | | | | | | | | | | | `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-242-4/+65
|\ \ | |/ | | | | | | * PHP-7.4: Fix #79487: ::getStaticProperties() ignores property modifications
| * Fix #79487: ::getStaticProperties() ignores property modificationsChristoph M. Becker2020-06-242-4/+65
| | | | | | | | | | When retrieving the static class properties via reflection, we have to cater to possible modifications.
* | Include stub hash in generated arginfo filesNikita Popov2020-06-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The hash is used to check whether the arginfo file needs to be regenerated. PHP-Parser will only be downloaded if this is actually necessary. This ensures that release artifacts will never try to regenerate stubs and thus fetch PHP-Parser, as long as you do not modify any files. Closes GH-5739.
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-06-232-65/+4
|\ \ | |/ | | | | | | * PHP-7.4: Revert "Fix #79487: ::getStaticProperties() ignores property modifications"
| * Revert "Fix #79487: ::getStaticProperties() ignores property modifications"Christoph M. Becker2020-06-232-65/+4
| | | | | | | | This reverts commit a895bb6885fbceea3e8375816969d5510d8d082e.
* | Merge branch 'PHP-7.4'Christoph M. Becker2020-06-232-4/+65
|\ \ | |/ | | | | | | * PHP-7.4: Fix #79487: ::getStaticProperties() ignores property modifications
| * Fix #79487: ::getStaticProperties() ignores property modificationsChristoph M. Becker2020-06-232-4/+65
| | | | | | | | | | When retrieving the static class properties via reflection, we have to cater to possible modifications.
* | Add ZVAL_OBJ_COPY macroNikita Popov2020-06-171-22/+11
| | | | | | | | | | For the common ZVAL_OBJ + GC_ADDREF pattern. This mirrors the existing ZVAL_STR_COPY API.
* | Add zend_call_known_function() API familyNikita Popov2020-06-091-75/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge branch 'PHP-7.4'Nikita Popov2020-06-091-0/+35
|\ \ | |/ | | | | | | * PHP-7.4: Fixed bug #79683
| * Fixed bug #79683Nikita Popov2020-06-091-0/+35
| | | | | | | | | | | | | | Reset fake_scope during __toString() call. I'll check if we can solve this more globally in master, by resetting fake_scope in zend_call_function.
* | Fix typo of IteratorAggregateImplPhil Davis2020-06-081-4/+4
| | | | | | | | Closes GH-5682.
* | Add $filter parameter for ReflectionClass::(getConstants|getReflectionConstants)Gabriel Caruso2020-06-076-22/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix tests' description for `ReflectionClass::getConstant`Gabriel Caruso2020-06-071-7/+7
| |
* | Fix expression warnings and break warningstwosee2020-06-071-3/+3
| | | | | | | | Close GH-5675.
* | Implement "Constructor Promotion" RFCNikita Popov2020-06-055-2/+117
| | | | | | | | | | | | RFC: https://wiki.php.net/rfc/constructor_promotion Closes GH-5291.
* | Add AttributesBenjamin Eberlei2020-06-046-4/+488
| | | | | | | | Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
* | Fix #79652 Ensure that the mixed type is displayed instead of the union of ↵Máté Kocsis2020-05-301-1/+1
| | | | | | | | | | | | all types Closes GH-56430
* | Improve type error messages when an object is givenMáté Kocsis2020-05-263-3/+3
| | | | | | | | | | | | | | From now on, we always display the given object's type instead of just reporting "object". Additionally, make the format of return type errors match the format of argument errors. Closes GH-5625
* | Annotate internal functions with the mixed typeMáté Kocsis2020-05-252-5/+7
| | | | | | | | Closes GH-5618
* | Add support for the mixed typeMáté Kocsis2020-05-222-3/+35
| | | | | | | | | | | | | | RFC: https://wiki.php.net/rfc/mixed_type_v2 Closes GH-5313 Co-authored-by: Dan Ackroyd <danack@basereality.com>
* | Improve error message for deprecated methodsMáté Kocsis2020-05-147-37/+37
| |
* | Deprecate old ReflectionParameter type declaration APIsNikita Popov2020-05-118-26/+103
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This deprecates: ReflectionParameter::isArray() ReflectionParameter::isCallable() ReflectionParameter::getClass() These APIs have been superseded by ReflectionParameter::getType() since PHP 7.0. Types introduced since that time are not available through the old APIs, and their behavior is getting increasingly confusing. This is how they interact with PHP 8 union types: * isArray() will return true if the type is array or ?array, but not any other union type * Same for isCallable(). * getClass() will return a class for T|int etc, as long as the union only contains a single type. T1|T2 will return null. This behavior is not particularly reasonable or useful, and will get more confusing as new type system extensions are added. Closes GH-5209.