summaryrefslogtreecommitdiff
path: root/Zend/zend_execute.c
Commit message (Collapse)AuthorAgeFilesLines
* A helper to trace executed source linesDmitry Stogov2020-06-101-0/+2
|
* Add helper APIs for maybe-interned string creationtwosee2020-06-081-2/+2
| | | | | | | | | | | | Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using ZVAL_INTERNED_STRING and ZSTR_CHAR. Add zend_string_init_fast() as a helper for the empty string / one char interned string / zend_string_init() pattern. Also add corresponding ZVAL_STRINGL_FAST etc macros. Closes GH-5684.
* micro-optimizationDmitry Stogov2020-06-051-1/+8
|
* Add AttributesBenjamin Eberlei2020-06-041-0/+1
| | | | Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
* Improve type error messages when an object is givenMáté Kocsis2020-05-261-13/+7
| | | | | | | 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
* Merge branch 'PHP-7.4'Nikita Popov2020-05-261-32/+28
|\ | | | | | | | | * PHP-7.4: Fix zend_assign_to_typed_ref() implementation
| * Fix zend_assign_to_typed_ref() implementationNikita Popov2020-05-261-32/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was some confusion going on here regarding the original value vs the copied value. I've dropped the needs_copy variable, because this code is not inlined, so it would always be true anyway. What we need to do is perform a move-assignment of the copied value (in which case we don't care about performing the assignment before destroying garbage), and destroying the original value for the VAR/TMP cases. This is a bit complicated by the fact that references are passed in via a separate ref variable, so we can't just ptr_dtor the original variable.
| * Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-04-021-4/+8
| |\ | | | | | | | | | | | | * PHP-7.3: Fixed bug #79434
| | * Fixed bug #79434Nikita Popov2020-04-021-4/+8
| | |
* | | Improve error messages for invalid property accessMáté Kocsis2020-05-181-6/+11
| | | | | | | | | | | | | | | Closes GH-5446 Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
* | | Improve error message for deprecated methodsMáté Kocsis2020-05-141-5/+9
| | |
* | | Use zend_zval_type_name() API where possibleNikita Popov2020-05-131-7/+7
| | | | | | | | | | | | Rather than zend_get_type_by_const(Z_TYPE_P()).
* | | Fixed false alarm about tmp_name maybe unitializedXinchen Hui2020-05-071-7/+8
| | |
* | | Improve undefined variable error messagesMáté Kocsis2020-03-311-2/+2
| | | | | | | | | | | | Closes GH-5312
* | | Remove unnecessary uses of CHECK_SILENTNikita Popov2020-03-061-1/+1
| | | | | | | | | | | | If no error is passed, it is always silent.
* | | Change argument error message formatMáté Kocsis2020-02-261-10/+16
| | | | | | | | | | | | Closes GH-5211
* | | Reorder checks in object ref assignmentNikita Popov2020-02-251-27/+26
| | | | | | | | | | | | | | | First check for IS_INDIRECT and de-indirect it directly there. Handle the error cases later.
* | | Make type error messages more consistentMáté Kocsis2020-02-171-112/+30
| | | | | | | | | | | | Closes GH-5092
* | | Add static return typeNikita Popov2020-02-171-6/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Basic JIT support for verify returnNikita Popov2020-02-071-1/+1
| | |
* | | Merge branch 'PHP-7.4'Dmitry Stogov2020-02-061-2/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Make opcodes to return de-refereced values of typed references (in the same was as for non-typed)
| * | Make opcodes to return de-refereced values of typed references (in the same ↵Dmitry Stogov2020-02-061-2/+2
| | | | | | | | | | | | was as for non-typed)
* | | Fix some -Wold-style-declaration compiler warningsGeorge Peter Banyard2020-02-051-1/+1
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2020-02-031-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Apply tidy formatting
* | | We don't need "safe" destruction anymoreDmitry Stogov2020-01-311-9/+1
| | |
* | | Merge branch 'PHP-7.4'Dmitry Stogov2020-01-311-0/+33
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fixed bug #79094 (Crashing when running recursion function)
| * | Fixed bug #79094 (Crashing when running recursion function)Dmitry Stogov2020-01-311-0/+33
| | |
* | | Add support for deprecating constantsNikita Popov2020-01-171-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Internal constants can be marked as CONST_DEPRECATED, in which case accessing them will throw a deprecation warning. For now this is only supported on global constants, not class constants. Complain to me if you need to deprecate a class constant... Closes GH-5072.
* | | Use zend_type inside type listsNikita Popov2020-01-171-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Fix #49555: Improve "function must be a string" error messageNikita Popov2020-01-081-2/+2
| | | | | | | | | | | | | | | Be more specific for the individual cases and provide relevant type information.
* | | Add warning and convert to exception in string offset assignment:George Peter Banyard2020-01-071-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | Convert the empty string assignment to an Error as per RFC [1] Add a warning that only the first byte will be assigned to the offset if provided a needle that is longer than one byte. [1] https://wiki.php.net/rfc/engine_warnings
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-301-0/+2
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Properly propagate url_stat exceptions during include
| * | Properly propagate url_stat exceptions during includeNikita Popov2019-12-301-0/+2
| | | | | | | | | | | | | | | Make sure we abort operations early, and that we don't emit additional warnings or errors if an exception has been thrown.
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-191-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Avoid signed integer overflow in string offset check
| * | Avoid signed integer overflow in string offset checkNikita Popov2019-12-191-1/+1
| | | | | | | | | | | | Cast to size_t before performing operations instead of afterwards.
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-181-3/+0
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix leak in assign_ref with function
| * | Fix leak in assign_ref with functionNikita Popov2019-12-181-3/+0
| | | | | | | | | | | | | | | As far as I can see, the retval copying is already done in all callers of this function, so it should not be duplicated here.
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-181-1/+3
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix const/cv freeing on failed reference assignment
| * | Fix const/cv freeing on failed reference assignmentNikita Popov2019-12-181-1/+3
| | |
* | | Fix leak of dynamic property name in address helperNikita Popov2019-12-171-4/+9
| | |
* | | Merge branch 'PHP-7.4'Dmitry Stogov2019-12-091-0/+7
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Export zend_init_func_run_time_cache()
| * | Export zend_init_func_run_time_cache()Dmitry Stogov2019-12-091-0/+7
| | |
* | | Remove unused functionNikita Popov2019-12-061-9/+0
| | |
* | | Optimize return type checkingNikita Popov2019-12-061-15/+21
| | | | | | | | | | | | Split off the fast-path case and avoid redundant checks.
* | | Implement union typesNikita Popov2019-11-081-219/+323
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | According to RFC: https://wiki.php.net/rfc/union_types_v2 The type representation now makes use of both the pointer payload and the type mask at the same time. Additionall, zend_type_list is introduced as a new kind of pointer payload, which is used to store multiple class types. Each of the class types is a tagged pointer, which may be either a class name or class entry. The latter is only used for typed properties, while arguments/returns will instead use cache slots. A type list can contain a mix of both names and CEs at the same time, as not all classes may be resolvable. One thing this is missing is support for union types in arginfo and stubs, which I want to handle separately. I've also dropped the special object code from the JIT implementation for now -- I plan to add this back in a different form at a later time. For now I did not want to include non-trivial JIT changes together with large functional changes. Another possible piece of follow-up work is to implement "iterable" as an internal alias for "array|Traversable". I believe this will eliminate quite a few special-cases that had to be implemented. Closes GH-4838.
* | | Make zend_type a 2-field structNikita Popov2019-11-081-16/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now store the pointer payload and the type mask separately. This is in preparation for union types, where we will be using both at the same time. To avoid increasing the size of arginfo structures, the pass_by_reference and is_variadic fields are now stored as part of the type_mask (8-bit are reserved for custom use). Different types of pointer payloads are distinguished based on bits in the type_mask.
* | | Fix consistency issues with array accesses warnings/exceptionsMáté Kocsis2019-11-061-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Change a number of "resource used as offset" notices to warnings, which were previously missed. * Throw the "resource used as offset" warning for isset() as well. * Make array_key_exists() behavior with regard to different key types consistent with isset() and normal array accesses. All key types now use the usual coercions and array/object keys throw TypeError. Closes GH-4887.
* | | Remove support for array_key_exists() with objectsNikita Popov2019-11-041-23/+15
| | |
* | | Check type is set when verifying variadic argsNikita Popov2019-10-251-1/+2
| | | | | | | | | | | | | | | | | | | | | Weird that there was no test for this... This code is somewhat inefficient, because it will be performed for every arg, rather than only once.
* | | Remove unnecessary type checks in verify_missing_return_typeNikita Popov2019-10-241-13/+9
| | | | | | | | | | | | | | | We don't emit VERIFY_RETURN_TYPE for void functions, so there's no need to check it here. It's always an error.