| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Closes GH-5736.
|
| |
|
|
|
|
|
|
|
|
|
| |
Instead of marking unreachable code with `ZEND_ASSERT(0)`, we introduce
`ZEND_UNREACHABLE()`, so that MSVC which does not consider `assert(0)`
to mark unreachable code does no longer trigger C4715[1] warnings in
debug builds. This may be useful for other compilers as well.
[1] <https://docs.microsoft.com/de-de/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4715?view=vs-2019>
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a bit tricky: In this cases we have "namespace as", which
means that we will only recognize "namespace" as an identifier when
the lookahead token is already at the "as". This means that
zend_lex_tstring picks up the wrong identifier.
We solve this by actually assigning the identifier as the semantic
value on the parser stack -- as in almost all cases we will not
actually need the identifier, this is just an (offset, size)
reference, not a copy of the string.
Additionally, we need to teach the lexer feedback mechanism used
by tokenizer TOKEN_PARSE mode to apply feedback to something
other than the very last token. To that purpose we pass through
the token text and check the tokens in reverse order to find the
right one.
Closes GH-5668.
|
|
|
|
| |
Closes GH-5676.
|
|
|
|
| |
Close GH-5675.
|
|
|
|
|
|
| |
RFC: https://wiki.php.net/rfc/constructor_promotion
Closes GH-5291.
|
|
|
|
| |
Co-authored-by: Martin Schröder <m.schroeder2007@gmail.com>
|
|
|
|
|
|
| |
all types
Closes GH-56430
|
|
|
|
| |
This is no longer a boolean.
|
|
|
|
|
|
|
|
|
|
| |
Fixes an edge case overlooked in
https://github.com/php/php-src/pull/5313
Generators are objects, so `object` should have also been allowed in addition to
`iterable` and `Traversable`
Closes GH-5626
|
|
|
|
|
|
| |
RFC: https://wiki.php.net/rfc/non-capturing_catches
Closes GH-5345.
|
|
|
|
| |
Closes GH-5221
|
|
|
|
|
|
|
| |
RFC: https://wiki.php.net/rfc/mixed_type_v2
Closes GH-5313
Co-authored-by: Dan Ackroyd <danack@basereality.com>
|
|\
| |
| |
| |
| | |
* PHP-7.4:
Fix bug #79603, by retrying on RTD key collision
|
| |
| |
| |
| |
| |
| |
| | |
This is a non-intrusive fix for 7.4, still trying to find a good
solution for master.
Closes GH-5597.
|
| |
| |
| |
| | |
Rather than zend_get_type_by_const(Z_TYPE_P()).
|
| |
| |
| |
| |
| |
| | |
RFC: https://wiki.php.net/rfc/arithmetic_operator_type_checks
Closes GH-5331.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| | |
Fix Bug #79521.
Closes GH-5462.
|
| |
| |
| |
| | |
Closes GH-5465
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Mark "throw" used in expression context with a flag, and don't
treat it as a BB terminator in that case. This prevents us from
optimizing away the following opcodes as unreachable, which may
result in live ranges being dropped incorrectly.
Close GH-5450.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
- zend_hash_find_ptr_lc(ht, zend_string *key)
- zend_hash_str_find_ptr_lc(ht, const char *str, size_t len)
Note that zend_hash_str_find_ptr_lc used to exist in zend_compile.c
as zend_hash_find_ptr_lc. When exporting this I figured it
was best to use the same conventions as the rest of zend_hash.h.
|
| |
| |
| |
| | |
Closes GH-5441
|
| | |
|
| |
| |
| |
| | |
Make this use the same pattern we use everywhere else.
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
RFC: https://wiki.php.net/rfc/throw_expression
This has an open issue with temporaries that are live at the time
of the throw being leaked. Landing this now for easier testing and
will revert if we cannot resolve the issue.
Closes GH-5279.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is only used in reflection, where doing a simple string check
is acceptable.
I'm also dropping the "dtor" printing in the reflection dump.
Dtors are just one of many magic methods, I don't think there's
a point in explicitly highlighting them, when the name is already
unambiguous.
|
| | |
|
| |
| |
| |
| | |
Closes GH-5397.
|
| | |
|
| |
| |
| |
| | |
This is a recurring pattern.
|
| | |
|
| |
| |
| |
| |
| |
| | |
For division (rather than modulus) we should check the double
value, otherwise the result might be zero after integer truncation,
but not zero as a floating point value.
|
| |
| |
| |
| |
| | |
Move everything into one function and share it with opcache.
This fixes some discrepancies.
|
| |
| |
| |
| |
| |
| | |
RFC: https://wiki.php.net/rfc/abstract_trait_method_validation
Closes GH-5068.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit bb43a3822e42dbd15b1d416a166549d3980b379a.
After thinking about this a bit more, this is now going to be
a complete solution for the "readonly properties" case, for example:
unset($foo->readOnly->bar);
should also be legal and
$foo->readOnly['bar'] = 42;
should also be legal if $foo->readOnly is not an array but an
ArrayAccess object.
I think it may be better to distinguish better on the BP_VAR flag
level. Reverting for now.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
$a->b->c = 'd';
is now compiled the same way as
$b = $a->b;
$b->c = 'd';
That is, we perform a read fetch on $a->b, rather than a write
fetch.
This is possible, because PHP 8 removed auto-vivification support
for objects, so $a->b->c = 'd' may no longer modify $a->b proper
(i.e. not counting interior mutability of the object).
Closes GH-5250.
|
|\ \
| |/
| |
| |
| |
| |
| |
| | |
* PHP-7.4:
Check asserts early
identation fix
Call global code of preloaded script in global context
Avoid "Anonymous class wasn't preloaded" error by lazely loading of not preloaded part of a preloaded script
|
| | |
|
| |
| |
| |
| | |
preloaded part of a preloaded script
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Currently, trait methods are aliased will continue to use the
original function name. In a few places in the codebase, we will
try to look up the actual method name instead. However, this does
not work if an aliased method is used indirectly
(https://bugs.php.net/bug.php?id=69180).
I think it would be better to instead actually change the method
name to the alias. This is in principle easy: We have to allow
function_name to be changed even if op array is otherwise shared
(similar to static_variables). This means we need to addref/release
the function_name separately, but I don't think there is a
performance concern here (especially as everything is usually
interned).
There is a bit of complication in opcache, where we need to make
sure that the function name is released the correct number of times
(interning may overwrite the name in the original op_array, but we
need to release it as many times as the op_array is shared).
Fixes bug #69180.
Fixes bug #74939.
Closes GH-5226.
|
| | |
|
| | |
|
| | |
|
| |
| |
| |
| | |
Not sure why I missed these before.
|
| |
| |
| |
| |
| |
| |
| |
| | |
As an exception, we allow "Type $foo = null" to occur before a
required parameter, because this pattern was used as a replacement
for nullable types in PHP versions older than 7.1.
Closes GH-5067.
|