1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 07:28:09 +02:00
Commit Graph

380 Commits

Author SHA1 Message Date
Arnaud Le Blanc 5d1f3e047c Fix generator memory leaks when interrupted during argument evaluation (#9756) 2022-11-04 15:55:55 +01:00
Nikita Popov 6188b7a1da Revert "Change calling convention of zval_update_constant[_ex]() to fastcall."
This reverts commit 5a447b086b.

Revert this ABI break from PHP-8.0, leaving it only on master.
2020-10-09 15:06:12 +02:00
Dmitry Stogov 5a447b086b Change calling convention of zval_update_constant[_ex]() to fastcall. 2020-10-08 02:04:38 +03:00
Máté Kocsis 3053f6f2fa Fix prototype of get_active_function_or_method_name() 2020-09-12 19:10:48 +02:00
Dmitry Stogov 7b0a053169 JIT for ASSIGN_OBJ 2020-09-10 23:41:50 +03:00
Dmitry Stogov e9b47df14f Fixed 32-bit JIT 2020-09-10 16:55:08 +03:00
Máté Kocsis 9975986b7e Improve error messages mentioning parameters instead of arguments
Closes GH-5999
2020-09-09 10:47:43 +02:00
Nikita Popov b2bc2c62fa Remove unnecessary cache_slot arguments
zend_verify_type_error_common() no longer needs the cache_slot,
so drop it there and from all users.
2020-08-28 17:15:09 +02:00
George Peter Banyard fa8d9b1183 Improve type declarations for Zend APIs
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
2020-08-28 15:41:27 +02:00
Nikita Popov df5011f56c Export and reuse zend_is_valid_class_name API
Unserialization does the same check as zend_lookup_class, so let's
share the same optimized implementation.
2020-08-28 10:06:01 +02:00
Nikita Popov d92229d8c7 Implement named parameters
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.
2020-07-31 15:53:36 +02:00
Nikita Popov f60cf0cfe7 Remove type argument from zend_get_zval_ptr
As pointed out by Levi, this is unused, and we already changed
the signature of this function for PHP 8.
2020-07-15 09:51:51 +02:00
Nikita Popov cdc4ea2a5c JIT support for undefined index/offset handling 2020-07-07 15:13:03 +02:00
Nikita Popov 795d2cbd71 Reuse warning function 2020-07-06 10:38:02 +02:00
Nikita Popov 5b59d4915c Cleanup SPL autoload implementation
Replace EG(autoload_func) with a C level zend_autoload hook.
This avoids having to do one indirection through PHP function
calls. The need for EG(autoload_func) was a leftover from the
__autoload() implementation.

Additionally, drop special-casing of spl_autoload(), and instead
register it just like any other autoloading function. This fixes
bug #71236 as a side-effect.

Finally, change spl_autoload_functions() to always return an array.
The distinction between false and an empty array no longer makes
sense here.

Closes GH-5696.
2020-06-10 09:38:47 +02:00
Dmitry Stogov 91f283a0bf micro-optimization 2020-06-05 14:20:39 +03:00
Máté Kocsis 93640db4d5 Improve error message for deprecated methods 2020-05-14 17:23:31 +02:00
Alex Dowad f0960879e4 zend_timeout is not a signal handler function
The 'int dummy' parameter to this function makes it appear that it was intended as a
signal handler, but it is not being used as such. So remove the redundant parameter.
2020-05-12 17:13:46 +02:00
Máté Kocsis ac0853eb26 Make type error messages more consistent
Closes GH-5092
2020-02-17 14:22:17 +01:00
Nikita Popov 43443857b7 Add static return type
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.
2020-02-17 11:51:09 +01:00
Nikita Popov bc6bab6cb4 Basic JIT support for verify return 2020-02-07 12:59:48 +03:00
Dmitry Stogov 2b279b428f We don't need "safe" destruction anymore 2020-01-31 16:01:09 +03:00
Nikita Popov 0a2f6c5527 Move undefined constant error into get_constant_ex
All the other error conditions are already handled in there, so
this one should be as well.
2020-01-10 11:48:10 +01:00
Dmitry Stogov b1577f5a57 Merge branch 'PHP-7.4'
* PHP-7.4:
  Export zend_init_func_run_time_cache()
2019-12-09 15:58:19 +03:00
Dmitry Stogov 03d1c788ea Export zend_init_func_run_time_cache() 2019-12-09 15:58:00 +03:00
Nikita Popov fe6c420b02 JIT: Handle typed refs in assign dim 2019-10-23 11:25:10 +02:00
Nikita Popov e80934d747 Pass cache slot when printing type errors
Instead of using a separate ce.
2019-10-17 17:06:48 +02:00
Nikita Popov 9e8ba7891e Change representation of zend_type from type code to MAY_BE_* mask
This switches zend_type from storing a single IS_* type code to
storing a MAY_BE_* type mask. Right now most code still assumes
that there is only a single type in the mask (or two together
with MAY_BE_NULL). But this will make it a lot simpler to introduce
union types.

An additional advantage (and why I'm doing this separately), is
that a number of special cases no longer need to be handled
separately: We can do a single mask & (1 << type) check to handle
all simple types, booleans (true|false) and null.
2019-09-23 15:31:35 +02:00
Dmitry Stogov 57d9b94dea Simplify TMP/VAR operand releasing 2019-07-24 14:13:40 +03:00
Dmitry Stogov 53bcc2339c Merge branch 'PHP-7.4'
* PHP-7.4:
  Cleanup
2019-06-21 11:46:33 +03:00
Dmitry Stogov e1e8e670df Cleanup 2019-06-21 11:43:17 +03:00
Nikita Popov 4d90848d68 Don't verify arginfo types for internal functions
To avoid duplicate type checks. In debug builds arginfo is still
checked and will generate an assertions if the function doesn't
subsequently throw an exception.

Some test results change due to differences in zpp and arginfo
error messages.
2019-06-17 11:46:28 +02:00
twosee 61f78de486 Constify some char* arguments or return values of ZEND_API
Closes GH-4247.
2019-06-12 16:49:32 +02:00
Dmitry Stogov 207d928da8 Merge branch 'PHP-7.4'
* PHP-7.4:
  zend_assign_to_variable() optimization
2019-05-29 13:59:01 +03:00
Dmitry Stogov b06f05bf47 zend_assign_to_variable() optimization 2019-05-29 13:58:37 +03:00
Dmitry Stogov 6d89553c48 Merge branch 'PHP-7.4'
* PHP-7.4:
  Mark "cold" functions
2019-05-29 11:50:27 +03:00
Dmitry Stogov e14d77335c Mark "cold" functions 2019-05-29 11:48:41 +03:00
Nikita Popov 31a516cf96 Remove set() object handler 2019-05-29 10:00:06 +02:00
Dmitry Stogov 0d102515bf zend_do_fcall_overloaded() doesn't have to be exported 2019-05-29 10:32:30 +03:00
Nikita Popov 13f675b858 Merge branch 'PHP-7.4' 2019-05-27 09:38:33 +02:00
Nikita Popov e6fac86dc3 Accept flags argument in zend_lookup_class_ex()
Instead of a single boolean, so we have space for extension here.
2019-05-27 09:36:25 +02:00
Dmitry Stogov 139da4b271 Merge branch 'PHP-7.4'
* PHP-7.4:
  Removed ability to compile PHP without EX(run_time_cache). ZEND_EX_USE_RUN_TIME_CACHE was always defined.
2019-05-15 11:07:51 +03:00
Dmitry Stogov f9e8015847 Removed ability to compile PHP without EX(run_time_cache). ZEND_EX_USE_RUN_TIME_CACHE was always defined. 2019-05-15 11:06:26 +03:00
Dmitry Stogov 55cc280429 Backported call frame initialization improvement 2019-04-12 02:35:42 +03:00
Dmitry Stogov cc900edd77 Simplify call frame initialization 2019-04-11 02:08:32 +03:00
Dmitry Stogov e05867f089 Merge branch 'PHP-7.4'
* PHP-7.4:
  Eliminated check for assignment to itself
2019-04-09 15:37:50 +03:00
Dmitry Stogov ec5d4c79d2 Eliminated check for assignment to itself 2019-04-09 15:37:19 +03:00
Dmitry Stogov 578049f157 Merge branch 'PHP-7.4'
* PHP-7.4:
  Micro-optimization
2019-04-09 14:39:15 +03:00
Dmitry Stogov 5fdee9394f Micro-optimization 2019-04-09 14:38:49 +03:00
Dmitry Stogov f53240dbc4 Use fastcall calling convention 2019-04-02 23:49:13 +03:00