Fix property access of PHP objects wrapped in variant #16331
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First, we fix the long standing issue that property access throws a
com_exception
("0x80020003: member not found), because theHRESULT
was not properly set after accessing the property.Next, we fix an issue introduced as of PHP 7.0.0, where the string length for write access had been properly adapted, but the string length for read access had been overlooked.
Then we fix an issue introduced as of PHP 8.0.0, where new
HashTable
s no longer setnNextFreeElement
to zero, but toZEND_LONG_MIN
. This doesn't work well with theDISPID
lookup, which is aLONG
.Finally we fix a potential double-free due to erroneously destroying the return value of
zend_read_property()
.Given that this is completely broken as of PHP 8.0.0 at least, and apparently nobody has complained, I think we're good targeting master (we can backport later if necessary).
Note that this doesn't fix calling methods, which is broken since 2005, because
DISPATCH_METHOD|DISPATCH_PROPERTYGET
is passed as flag, and the latter is always prioritized indisp_invokeex()
(what is likely good for regular COM objects).