mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
First, we fix the long standing issue that property access throws a
`com_exception` ("0x80020003: member not found), because the `HRESULT`
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 set `nNextFreeElement` to zero, but to `ZEND_LONG_MIN`. This
doesn't work well with the `DISPID` lookup, which is a `LONG`.
Finally we fix a potential double-free due to erroneously destroying
the return value of `zend_read_property()`.
Closes GH-16331.
34 lines
608 B
PHP
34 lines
608 B
PHP
--TEST--
|
|
Testing reading and writing of properties
|
|
--EXTENSIONS--
|
|
com_dotnet
|
|
--FILE--
|
|
<?php
|
|
class MyClass {
|
|
public $foo = "foo";
|
|
public string $bar = "bar";
|
|
}
|
|
|
|
$o = new MyClass();
|
|
$v = new variant($o);
|
|
var_dump($v->foo);
|
|
var_dump($v->bar);
|
|
$v->foo = "new foo";
|
|
var_dump($v->foo instanceof variant);
|
|
var_dump((string) $v->foo);
|
|
var_dump($o->foo instanceof variant);
|
|
var_dump((string) $o->foo);
|
|
$v->bar = "new bar";
|
|
var_dump($v->bar);
|
|
var_dump($o->bar);
|
|
?>
|
|
--EXPECT--
|
|
string(3) "foo"
|
|
string(3) "bar"
|
|
bool(true)
|
|
string(7) "new foo"
|
|
bool(true)
|
|
string(7) "new foo"
|
|
string(7) "new bar"
|
|
string(7) "new bar"
|