Nikita Popov
776726da03
Add missing resource key warning for unset()
...
It was present on other operations, including isset(), but was
missing for unset().
2021-01-26 12:51:02 +01:00
Nikita Popov
3e01f5afb1
Replace zend_bool uses with bool
...
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.
2021-01-15 12:33:06 +01:00
Dmitry Stogov
9fc11762e5
PHP array cannot refer to EG(symbol_table) any more. Replace corresponding checks by ZEND_ASSERT().
2021-01-11 18:26:01 +03:00
Nikita Popov
22793884b6
Remove some INDIRECT handling in VM
2021-01-06 12:46:31 +01:00
Nikita Popov
3c68f38fda
Restrict allowed usages of $GLOBALS
...
This restricts allowed usage of $GLOBALS, with the effect that
plain PHP arrays can no longer contain INDIRECT elements.
RFC: https://wiki.php.net/rfc/restrict_globals_usage
Closes GH-6487.
2021-01-06 12:46:24 +01:00
Dmitry Stogov
841b00f641
Preallocate stack space for JIT in execute_ex() to eliminate JIT prologue/epilogue.
2020-11-30 17:56:08 +03:00
Sammy Kaye Powers
58d41b8c4f
Provide unused retvals to observers
...
Make sure that the return value is available to observers, even if
it is not used by the caller.
Closes GH-6422.
2020-11-17 10:28:47 +01:00
Dmitry Stogov
855d8fa68f
[Observer] Save opline before calling begin/end handlers
2020-11-11 13:06:55 +03:00
Nikita Popov
1748b8111e
Fix handling of throwing undef var in verify return
...
If we have an undefined variable and null is not accepted by the
return type, we want to throw just the undef var error.
In this case this lead to an infinite loop, because we overwrite
the exception opline in SAVE_OPLINE and it does not get reset
when chaining into a previous exception. Add an assertiong to
catch this case earlier.
2020-10-13 11:43:43 +02:00
Nikita Popov
d953cd1862
Merge branch 'PHP-7.4' into PHP-8.0
...
* PHP-7.4:
Avoid non-object in FE_FREE
2020-10-12 09:46:38 +02:00
Nikita Popov
304141e8f8
Avoid non-object in FE_FREE
...
Even if the properties HT is empty, make sure we still leave an
object in the FE_RESET result, so our type inference results
stay correct.
2020-10-12 09:45:52 +02:00
Nikita Popov
623bf39e9c
Merge branch 'PHP-7.4' into PHP-8.0
...
* PHP-7.4:
Fixed bug #80186
2020-10-09 17:02:20 +02:00
Nikita Popov
15443f8af4
Fixed bug #80186
...
Early exit in FE_RESET if get_properties() returns empty array,
as we cannot add HT iterators to zend_empty_array.
2020-10-09 16:56:08 +02:00
Dmitry Stogov
fd81e708bc
Fixed incorrect behavior of observer API.
...
ZEND_HANDLE_EXCEPTION might call zend_observer_fcall_end() even if exception is cought by function. The fix moved zend_observer_fcall_end() into a right place and remove OBSERVER sepecialization for ZEND_HANDLE_EXCEPTION handler.
2020-10-07 17:06:53 +03:00
George Peter Banyard
2ee7e2982f
Promote count() warning to TypeError
...
Closes GH-6180
2020-09-21 21:29:15 +01:00
Nikita Popov
213b666781
Synchronize GET_CLASS/GET_CALLED_CLASS opcodes with functions
...
These error conditions throw in the function implementations,
make the opcodes match.
2020-09-21 15:06:04 +02:00
Dmitry Stogov
d5d31ea3b3
Cleanup observer API and add JIT support
2020-09-18 12:55:58 +03:00
Sammy Kaye Powers
9e94bcfdbc
Remove specialization of SPEC(OBSERVER) handlers
2020-09-18 00:47:36 +03:00
Bob Weinand
6d538e83aa
Fix OSS Fuzz issue: yielding from an aborted generator
2020-09-15 20:07:33 +02:00
Nikita Popov
3c53732332
Fix undef var exception handling in JMP_NULL
...
We need to initialize the result variable in the exceptional
case as well.
Fixes oss-fuzz #25526 .
2020-09-15 15:44:01 +02:00
Máté Kocsis
9975986b7e
Improve error messages mentioning parameters instead of arguments
...
Closes GH-5999
2020-09-09 10:47:43 +02:00
Dmitry Stogov
a6a96116ac
micro-optimization
2020-09-08 16:47:30 +03:00
Nikita Popov
cd1c36f772
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fixed bug #80049
2020-09-03 17:13:47 +02:00
Nikita Popov
2dabc4c305
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fixed bug #80049
2020-09-03 17:12:58 +02:00
Nikita Popov
46a49be6c8
Fixed bug #80049
...
Type checking may convert to refcounted values, so force freeing
of extra args.
2020-09-03 17:12:40 +02:00
Dmitry Stogov
0d157cf526
Micro-optimization
2020-09-02 17:31:48 +03:00
Levi Morrison
66c3e900e2
Add zend_observer API
...
Closes GH-5857.
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Co-authored-by: Sammy Powers <sammyk@datadoghq.com>
2020-09-01 09:59:59 -06:00
Nikita Popov
48e31be7a3
Fix FE_FETCH_R_SIMPLE specialization
...
After a99d08b5d1
the type can
include UNDEF. However, UNDEF can only reach FE_FREE, not FE_FETCH.
As such, simply ignore this type.
2020-09-01 14:43:06 +02:00
Nikita Popov
927771333b
Fix unused variable warning
2020-08-28 17:19:32 +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
86cd009718
Fix pass by ref error for named params
2020-08-26 15:10:08 +02:00
George Peter Banyard
1b2ec73c1d
Drop various unused macros/APIs
...
Also convert_libmagic_pattern() to return a zend_string*
Closes GH-6029
2020-08-26 12:59:43 +02:00
Nikita Popov
795ad1e354
Fix memory leak on unknown named param in iterator unpack
2020-08-26 12:19:17 +02:00
Nikita Popov
1003ae2692
Fix passing of undef var to named arg
...
This needs to use the previously computed argument target.
2020-08-26 11:53:02 +02:00
Nikita Popov
492621f99e
Fix memory leak on unknown named param
2020-08-26 11:44:15 +02:00
Nikita Popov
d7d2b060e1
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix memory leak when yielding from non-iterable
2020-08-26 11:32:56 +02:00
Nikita Popov
bf3e772361
Merge branch 'PHP-7.3' into PHP-7.4
...
* PHP-7.3:
Fix memory leak when yielding from non-iterable
2020-08-26 11:32:31 +02:00
Nikita Popov
d179e34e42
Fix memory leak when yielding from non-iterable
2020-08-26 11:32:01 +02:00
Nikita Popov
779e904465
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fix refcounting
2020-08-24 16:23:33 +02:00
Nikita Popov
bb54694f4f
Fix refcounting
2020-08-24 16:23:19 +02:00
Christoph M. Becker
5643f34a1e
Merge branch 'PHP-7.4' into master
...
* PHP-7.4:
Fix #79979 : passing value to by-ref param via CUFA crashes
2020-08-24 15:03:26 +02:00
Christoph M. Becker
6b6c2c003c
Fix #79979 : passing value to by-ref param via CUFA crashes
...
If a by-val send is not allowed, we must not do so. Instead we wrap
the value in a temporary reference.
Closes GH-6000
2020-08-24 14:08:32 +02:00
Dmitry Stogov
5c18ee58b9
Fixed use-after-free introduced by aed1f78515
2020-08-24 09:50:54 +03:00
Dmitry Stogov
aed1f78515
micro-optimization
2020-08-20 15:02:12 +03:00
Nikita Popov
42eda5160d
SAVE_OPLINE in NULL_HANDLER
...
Let's avoid crashing before the nice error message gets printed...
2020-08-11 15:14:50 +02:00
Nikita Popov
f491dabe40
Fix nullsafe operator on reference
...
Dereference the value before checking the type. As the happy path
necessarily has to check for references, I'm not bothering to
delay the comparison.
2020-08-11 15:11:36 +02:00
Nikita Popov
74c4381806
Merge branch 'PHP-7.4'
...
* PHP-7.4:
Fixed bug #79947
2020-08-10 10:13:34 +02:00
Nikita Popov
2d087210eb
Fixed bug #79947
...
Move the FREE_OP for op_data out of the zend_binary_assign_op_dim_slow()
slow path, so it can be used by the other error path as well. This
makes ASSIGN_DIM_OP structurally more similar to ASSIGN_DIM.
2020-08-10 10:11:56 +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