| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
etc.
Now properties are ordered according to their layout in zend_object structure.
|
|
|
|
|
| |
We should handle the case where the method doesn't exist, and
where it is not visible the same way.
|
|\
| |
| |
| |
| | |
* PHP-8.0:
Fixed bug #80723
|
| |
| |
| |
| |
| | |
This fixes the issue just for the Socket class. Presumably we'll
want to do the same for other "resource" objects.
|
|/
|
|
|
|
|
| |
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.
|
| |
|
|\
| |
| |
| |
| | |
* PHP-7.4:
Fix assumption about property guard hash value
|
| |
| |
| |
| |
| |
| |
| |
| | |
The "member" string here does not necessarily have a pre-calculated
hash value. In particular this is not the case if the class has no
properties.
Fixes oss-fuzz #25546.
|
| |
| |
| |
| |
| | |
That adds a ref if not immutable. Also audit uses of GC_IMMUTABLE
to either use GC_TRY_ADDREF or GC_TRY_PROTECT_RECURSION.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Check for null EX(func) in write_property
|
| |
| |
| |
| |
| |
| |
| |
| | |
This can happen if zend_call_function inserted a dummy frame,
and we already switched to the dummy frame in leave_helper,
and an exception is thrown during CV destruction.
Fixes oss-fuzz #25343.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix bug #80037
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If we're accessing an uninitialized typed property and __get is
defined, don't perform a read_property callback, as __get is
supposed to have no effect on uninitialized typed properties.
Usually it doesn't, but by-reference assignments cannot be
performed through read_property.
I'm deleting the test for bug #80039 again, as it doesn't really
make sense anymore with this fix.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #79862
|
| |
| |
| |
| |
| | |
While normally a private property in the active scope would take
priority, we should not use this if it has the wrong "staticness".
|
| |
| |
| |
| | |
Closes GH-5590
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
While performing resource -> object migrations, we're adding
defensive classes that are final, non-serializable and non-clonable
(unless they are, of course). This path adds a ZEND_ACC_NO_DYNAMIC_PROPERTIES
flag, that also forbids the creation of dynamic properties on these objects.
This is a subset of #3931 and targeted at internal usage only
(though may be extended to userland at some point in the future).
It's already possible to achieve this (what the removed
WeakRef/WeakMap code does), but there's some caveats: First, this
simple approach is only possible if the class has no declared
properties, otherwise it's necessary to special-case those
properties. Second, it's easy to make it overly strict, e.g. by
forbidding isset($obj->prop) as well. And finally, it requires a
lot of boilerplate code for each class.
Closes GH-5572.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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>
|
| |
| |
| |
| |
| |
| | |
We regularly find new places where we forgot to reset fake_scope.
Instead of having to handle this for each caller of zend_call_function()
and similar APIs, handle it directly in zend_call_function().
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #79683
|
| |
| |
| |
| |
| |
| |
| | |
Reset fake_scope during __toString() call.
I'll check if we can solve this more globally in master, by
resetting fake_scope in zend_call_function.
|
| |
| |
| |
| | |
Close GH-5675.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We specify that the return type of Exception::getMessage() is a
string. However, we don't currently ensure this, because
Exception::$message is a protected member that can be set to any
type. Fix this by performing an explicit type-cast.
This also requires a temporary refcount increment in the __toString()
object handler, because there is no additional owner of the object,
and it may get released prematurely as part of the __toString() call.
|
| | |
|
| |
| |
| |
| | |
This seems to stem from a copy paste, however there is no object variable in this function
|
| |
| |
| |
| |
| |
| |
| |
| | |
Avoid subtle differences in behavior depending on whether the
handler is absent or returns FAILURE.
If you previously set cast_object to NULL, create a handler that
always returns FAILURE instead.
|
| |
| |
| |
| |
| |
| | |
To explicitly indicate that objects are uncomparable. For now
this has no functional difference from the usual 1 return value,
but makes intent clearer.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make cast_object return FAILURE for casts to int/float, rather than
throwing a notice and returning SUCCESS. Instead move the emission
of the notice to the code invoking cast_object. This will allow us
to customize the behavior per call-site.
This change is written to be NFC, and the code in
zend_std_compare_objects() should illustrate the current behavior
doesn't make a lot of sense.
|
| |
| |
| |
| |
| | |
If we have a __call on a parent, we should always also have a
__call on the child, so there's no need to perform this walk.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #78904: Don't call any magic for uninitialized typed properties
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We already changed the behavior for __set() in f1848a4. However, it
seems that this is also a problem for all the other property magic,
see bug #78904.
This commit makes the behavior of all the property magic consistent:
Magic will not be triggered for uninitialized typed properties, only
explicitly unset() ones. This brings behavior more in line how
non-typed properties behave and avoids WTF.
Closes GH-4974.
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #78810
|
| | |
|
| | |
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fix bug #78226: Don't call __set() on uninitialized typed properties
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Assigning to an uninitialized typed property will no longer trigger
a call to __set(). However, calls to __set() are still triggered if
the property is explicitly unset().
This gives us both the behavior people generally expect, and still
allows ORMs to do lazy initialization by unsetting properties.
For PHP 8, we should fine a way to forbid unsetting of declared
properties entirely, and provide a different way to achieve lazy
initialization.
|
| |
| |
| |
| |
| |
| |
| |
| | |
Split out the simple equality check into an inline function --
this is one of the common cases.
Replace instanceof_function_ex with zend_class_implements_interface.
There are a few more places where it may be used.
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This goes in the reverse direction of 4463acb9513dfb62206760c49b3da1fe4d92f40a.
After looking around a bit, it seems that we already check for
Z_ISERROR_P() on the get_property_ptr_ptr return value in other places.
So do this in zend_fetch_property_address() as well, and also make
sure that EG(error_zval) is indeed returned on exception in
get_property_ptr_ptr.
In particular, this fixes the duplicate exceptions that we used to
get because first get_property_ptr_ptr threw one and then
read_property throws the same exception again.
|
| |
| |
| |
| |
| | |
- introduce zend_compare() that returns -1,0,1 dirctly (without intermediate zval)
- remove compare_objects() object handler, and keep only compare() handler
|
| |
| |
| |
| | |
Part of https://wiki.php.net/rfc/engine_warnings.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
`get_closure` handlers are called to check whether an object is
callable, and to actually get the closure, respectively. The behavior
of the handler might differ for these two cases, particularly the
handler may throw in the latter case, but should not in the former.
Therefore we add a `check_only` parameter, to be able to distinguish
the desired purpose.
|
| |
| |
| |
| |
| | |
Instead of a simple if or 0 comparison. This would no longer work
if zend_type is a struct.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Instead of checking for this during DO_FCALL, already detect this
case during get_method()/get_static_method(), similar to visibility
checks.
This causes a minor difference in behavior, in that arguments will
no longer be evaluated. I think this is correct though (and consistent
with visibility errors).
|
|\ \
| |/
| |
| |
| | |
* PHP-7.4:
Fixed bug #78379 (Cast to object confuses GC, causes crash)
|
| |\
| | |
| | |
| | |
| | | |
* PHP-7.3:
Fixed bug #78379 (Cast to object confuses GC, causes crash)
|
| | |\
| | | |
| | | |
| | | |
| | | | |
* PHP-7.2:
Fixed bug #78379 (Cast to object confuses GC, causes crash)
|