summaryrefslogtreecommitdiff
path: root/Zend/zend_API.h
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Fix [-Wundef] warning in Zend folderGeorge Peter Banyard2020-05-121-1/+1
|
* Remove old ARG_COUNT() macroGeorge Peter Banyard2020-05-111-1/+0
| | | | | | Use ZEND_NUM_ARGS() instead. Clsoes GH-5551
* Fix UNKNOWN default values in various extensionsMáté Kocsis2020-05-051-0/+6
| | | | Closes GH-5514
* Add Fast ZPP string|int type checkGeorge Peter Banyard2020-05-021-0/+36
|
* Convert UNKNOWN default values to null in ext/dateMáté Kocsis2020-05-021-0/+3
| | | | Closes GH-5509
* Completely remove disabled functions from function tableNikita Popov2020-04-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Pass existing lcname to check_magic_method_implementationNikita Popov2020-04-271-1/+2
|
* Generate method entries from stubs for a couple of extensionsMáté Kocsis2020-04-111-0/+1
| | | | Closes GH-5368
* Add support for generating method entries from stubsMáté Kocsis2020-04-111-1/+1
| | | | Closes GH-5363
* Add Z_PARAM_RESOURCE_OR_NULL()Nikita Popov2020-04-091-0/+3
| | | | As a more explicit alternative to Z_PARAM_RESOURCE_EX(, 1, 0).