summaryrefslogtreecommitdiff
path: root/Zend/zend_API.h
Commit message (Collapse)AuthorAgeFilesLines
* Fixed error messageDmitry Stogov2021-02-241-1/+3
|
* Deprecate passing null to non-nullable arg of internal functionNikita Popov2021-02-111-51/+51
| | | | | | | | | | | | | | | | | | | | | This deprecates passing null to non-nullable scale arguments of internal functions, with the eventual goal of making the behavior consistent with userland functions, where null is never accepted for non-nullable arguments. This change is expected to cause quite a lot of fallout. In most cases, calling code should be adjusted to avoid passing null. In some cases, PHP should be adjusted to make some function arguments nullable. I have already fixed a number of functions before landing this, but feel free to file a bug if you encounter a function that doesn't accept null, but probably should. (The rule of thumb for this to be applicable is that the function must have special behavior for 0 or "", which is distinct from the natural behavior of the parameter.) RFC: https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg Closes GH-6475.
* Added Inheritance Cache.Dmitry Stogov2021-02-091-0/+33
| | | | | | | | | | 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.
* Replace zend_bool uses with boolNikita Popov2021-01-151-26/+26
| | | | | | | 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.
* Remove Z_PARAM separate params where they don't make senseNikita Popov2021-01-141-72/+30
| | | | | | | | | Separation can only possibly make sense for array parameters (or something that can contain arrays, like zval parameters). It never makes sense to separate a bool. The deref parameters are also of dubious utility, but leaving them for now.
* Flesh out HashTable insertion APIsSara Golemon2020-12-011-0/+18
| | | | | | | | | | | | | | | | Fills out the array/object-property insert helpers for zend_array, zend_object, and zend_reference. This adds the following matrix of 18 APIs add_next_index_T() add_index_T() add_assoc_T() add_assoc_T_ex() add_property_T() add_property_T_ex() Where T in array, object, reference Converted internal callsites currently doing an explicit object wrap.
* Merge branch 'PHP-8.0'Nikita Popov2020-11-191-0/+3
|\ | | | | | | | | * PHP-8.0: Export zend_is_callable_at_frame
| * Export zend_is_callable_at_frameNikita Popov2020-11-191-0/+3
| | | | | | | | | | | | Export the zend_is_callable_impl() function as zend_is_callable_at_frame() for use by extension. As twose pointed out, an extension may want to retrieve fcc for a private method.
* | Sanity check zpp max argument countNikita Popov2020-10-141-0/+1
|/ | | | | | This would have prevented 9b4094c. Closes GH-6334.
* Use assertion for null-termination stringNikita Popov2020-09-211-4/+1
| | | | | Indicates an implementation bug, make sure we can automatically detect it.
* Declare array|int and object-of-class|int types in stubsMáté Kocsis2020-09-141-5/+72
| | | | | | Closes GH-6081 Co-Authored-By: Nikita Popov <nikic@php.net>
* Add Z_PARAM_OBJ_OF_CLASS ZPP macroMáté Kocsis2020-09-141-0/+37
|
* Consolidate new union type ZPP macro namesMáté Kocsis2020-09-111-46/+46
| | | | | | | They will now follow the canonical order of types. Older macros are left intact due to maintaining BC. Closes GH-6112
* Make null byte error a ValueErrorNikita Popov2020-09-081-2/+2
| | | | | | | | | | | | | Currently we treat paths with null bytes as a TypeError, which is incorrect, and rather inconsistent, as we treat empty paths as ValueError. We do this because the error is generated by zpp and it's easier to always throw TypeError there. This changes the zpp implementation to throw a TypeError only if the type is actually wrong and throw ValueError for null bytes. The error message is also split accordingly, to be more precise. Closes GH-6094.
* Use the canonical order of types in array|string ZPP error messagesMáté Kocsis2020-09-041-2/+2
|
* Add the Z_PARAM_ARRAY_HT_OR_NULL and Z_PARAM_OBJ macrosMáté Kocsis2020-09-041-0/+34
|
* Release call trampolines in zpp fccNikita Popov2020-09-041-0/+4
| | | | | | | | | | | | | | When using zpp 'f' or Z_PARAM_FUNC, if the fcc points to a call trampoline release it immediately and force zend_call_function to refetch it. This may require additional callability checks if __call is used, but avoids the need to carefully free fcc values in all internal functions -- in some cases this is not simple, as a type error might be triggered by a later argument in the same zpp call. This fixes oss-fuzz #25390. Closes GH-6073.
* Add Z_PARAM_ITERABLE and coLevi Morrison2020-09-031-0/+31
|
* Add more precise type info for stubsMáté Kocsis2020-09-011-0/+3
| | | | Closes GH-6005
* Rehash function table after disabling functionsNikita Popov2020-08-281-1/+1
| | | | | | | | | | | | To perform fast shutdown without full table cleanup we need all internal functions to be in one continuous chunk. This was violated when functions were deleted via disable_functions. This drops the zend_disable_function() API in favor of zend_disable_functions(), which disables the given list of functions and performs the necessary rehash afterwards. Also drop PG(disabled_functions), which is no longer used.
* Don't mark variadic functions as ZEND_FASTCALLNikita Popov2020-08-281-3/+3
| | | | Variadic functions do not support the fastcall calling convention.
* Improve type declarations for Zend APIsGeorge Peter Banyard2020-08-281-106/+106
| | | | | | | | | 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
* Use Z_PARAM_CLASS in PDOStatement::fetchObject()Nikita Popov2020-08-131-0/+3
| | | | Instead of implementing custom logic.
* Accept zend_object* in zend_update_propertyNikita Popov2020-08-071-9/+9
|
* Accept zend_object* in zend_unset_propertyNikita Popov2020-08-071-1/+1
|
* Accept zend_object in zend_read_propertyNikita Popov2020-08-071-2/+2
|
* Implement named parametersNikita Popov2020-07-311-5/+35
| | | | | | | | | | | | | | | | | | 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.
* Fix STR_OR_OBJ_OF_TYPE stringable handlingNikita Popov2020-07-291-15/+6
|
* Support class+mask union for internal argumentNikita Popov2020-07-241-0/+2
|
* Add the Z_PARAM_PATH_OR_NULL() and Z_PARAM_ZVAL_OR_NULL() macrosMáté Kocsis2020-07-241-0/+6
|
* Change type of max_num_args to uint32_ttwosee2020-07-231-3/+2
| | | | Closes GH-5885.
* Add common code for magic method assignmentNikita Popov2020-07-201-0/+1
| | | | This was repeated three times.
* Drop unused param in zend_parse_arg_class_name_or_obj()George Peter Banyard2020-07-171-2/+2
|
* Use consistent typesGeorge Peter Banyard2020-07-131-23/+23
| | | | | | | | uint32_t type for argument count size_t for length of char* zend_bool for a zval bool arg Closes GH-5845
* Add zend_wrong_parameter_error to reduce the size of ZPP macrotwosee2020-07-101-13/+2
| | | | Closes GH-5831.
* Voidify some ZEND_API functionsGeorge Peter Banyard2020-07-091-44/+44
| | | | Closes GH-5805
* Remove no_separation flagNikita Popov2020-07-071-5/+2
|
* Avoid some unnecessary uses of no_separation=0Nikita Popov2020-07-061-2/+2
| | | | | For the rare cases where references are part of the API, construct them explicitly. Otherwise do not allow separation.
* Add string or object ZPP macrosMáté Kocsis2020-07-061-7/+75
| | | | Closes GH-5788
* Add ZPP macros for class name or object parametersMáté Kocsis2020-06-301-0/+41
| | | | Closes GH-5647
* Cache __unserialize() instead of unserialize()Nikita Popov2020-06-261-2/+2
| | | | | We should use these cache slots for the new object serialization mechanism rather than the old one.
* Add ZVAL_OBJ_COPY macroNikita Popov2020-06-171-0/+2
| | | | | For the common ZVAL_OBJ + GC_ADDREF pattern. This mirrors the existing ZVAL_STR_COPY API.
* Use unused attribute for _dummyNikita Popov2020-06-121-2/+1
| | | | | | | | | The (void)_dummy is apparently considered a read of an uninitialized variable. As it is a _Bool now, which has trap representations, this is no longer considered legal and results in somewhat odd ubsan warnings of the form: runtime error: load of value 0, which is not a valid value for type 'zend_bool' (aka 'bool')
* Add zend_call_known_function() API familyNikita Popov2020-06-091-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add helper APIs for maybe-interned string creationtwosee2020-06-081-24/+44
| | | | | | | | | | | | 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.
* Constify char * arguments of APIstwosee2020-06-081-2/+2
| | | | Closes GH-5676.
* Add AttributesBenjamin Eberlei2020-06-041-2/+2
| | | | Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
* Refactor ZPP API to use uint32_t as everywhere elseGeorge Peter Banyard2020-05-221-5/+5
| | | | Closes GH-5609
* Allow null callback to array_filter()Nikita Popov2020-05-131-0/+3
| | | | With same behavior as not passing it.
* Rename zend_zval_get_type() APINikita Popov2020-05-131-1/+1
| | | | | | We have a bunch of APIs for getting type names and it's sometimes hard to keep them apart ... make it clear that this is the one you definitely do not want to use.