You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* VariantCopy will perform VariantClear; we don't want to clobber
* the IDispatch that we memcpy'd, so we init a new variant in the
* clone structure */
VariantInit(&cloneobj->v);
/* We use the Indirection-following version of the API since we
* want to clone as much as possible */
VariantCopyInd(&cloneobj->v, &origobject->v);
if (cloneobj->typeinfo) {
ITypeInfo_AddRef(cloneobj->typeinfo);
}
return (zend_object*)cloneobj;
}
That memcpy() is a "bit" crude, and while we cater to v and typeinfo, we apparently missed sink_dispatch and possibly the elements of method_cache. modified seems to need an reset (not sure, though).
(I also wonder why we store the ce.)
Anyhow, I wonder if that's worth fixing, or whether we should just forbid cloning in the first place; we can still implement proper cloning if requested.
PHP Version
master (but likely since PHP 7, or even before)
Operating System
Windows
The text was updated successfully, but these errors were encountered:
Honestly, I'm not sure cloning makes sense. Yes "cloning" a scalar variant is easy, but I have concerns about how crude the implementation is to properly clone more complicated variants such as arrays.
And as you said we can always relax this constraint further down the line.
[…] but I have concerns about how crude the implementation is to properly clone more complicated variants such as arrays.
Oh, indeed, that is not properly implemented. We would at least need to check the return value of VariantCopyInd() which may fail for different reasons, and in that case throw an exception.
Also 115ee49, where we prohibited serialization for good reasons. I think these operations have been hacked in, because PHP supports it generally, but were never properly implemented.
Description
The following code:
Resulted in this output:
But I expected no output instead.
php-src/ext/com_dotnet/php_com_dotnet_internal.h
Lines 28 to 49 in b14469b
php-src/ext/com_dotnet/com_handlers.c
Lines 594 to 616 in b14469b
That
memcpy()
is a "bit" crude, and while we cater tov
andtypeinfo
, we apparently missedsink_dispatch
and possibly the elements ofmethod_cache
.modified
seems to need an reset (not sure, though).(I also wonder why we store the
ce
.)Anyhow, I wonder if that's worth fixing, or whether we should just forbid cloning in the first place; we can still implement proper cloning if requested.
PHP Version
master (but likely since PHP 7, or even before)
Operating System
Windows
The text was updated successfully, but these errors were encountered: