Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Zend/tests/bug27798.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ array(3) {
}
Child::__construct
array(3) {
["Baz"]=>
int(4)
["Foo"]=>
int(1)
["Bar"]=>
int(2)
["Baz"]=>
int(4)
}
array(1) {
["Foo"]=>
Expand Down
8 changes: 4 additions & 4 deletions Zend/tests/bug60536_003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ var_dump($b);
?>
--EXPECTF--
object(SubclassA)#%d (2) {
["hello":"SubclassA":private]=>
int(0)
["hello":"BaseWithPropA":private]=>
int(0)
["hello":"SubclassA":private]=>
int(0)
}
object(SubclassB)#%d (2) {
["hello":"SubclassB":private]=>
int(0)
["hello":"BaseWithTPropB":private]=>
int(0)
["hello":"SubclassB":private]=>
int(0)
}
8 changes: 4 additions & 4 deletions Zend/tests/bug79862.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ NULL
NULL
NULL
object(c)#1 (6) {
["prop1"]=>
int(1)
["prop2":protected]=>
int(2)
["prop3":"a":private]=>
int(3)
["prop4":"a":private]=>
int(4)
["prop1"]=>
int(1)
["prop2":protected]=>
int(2)
["prop5"]=>
int(5)
["prop6"]=>
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/get_mangled_object_vars.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ echo "\n";
?>
--EXPECT--
array (
'' . "\0" . 'B' . "\0" . 'priv' => 4,
'pub' => 1,
'' . "\0" . '*' . "\0" . 'prot' => 2,
'' . "\0" . 'A' . "\0" . 'priv' => 3,
'' . "\0" . 'B' . "\0" . 'priv' => 4,
'dyn' => 5,
6 => 6,
)
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/objects_033.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ print_r($a, true);
var_dump($a < $b);
?>
--EXPECT--
bool(false)
bool(false)
bool(true)
bool(true)
12 changes: 6 additions & 6 deletions Zend/tests/traits/property008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ var_dump($b);
?>
--EXPECT--
object(SubclassClassicInheritance)#1 (2) {
["hello":"SubclassClassicInheritance":private]=>
int(0)
["hello":"BaseWithPropA":private]=>
int(0)
["hello":"SubclassClassicInheritance":private]=>
int(0)
}
object(SubclassA)#2 (2) {
["hello":"SubclassA":private]=>
int(0)
["hello":"BaseWithPropA":private]=>
int(0)
["hello":"SubclassA":private]=>
int(0)
}
object(SubclassB)#3 (2) {
["hello":"SubclassB":private]=>
int(0)
["hello":"BaseWithTPropB":private]=>
int(0)
["hello":"SubclassB":private]=>
int(0)
}
54 changes: 21 additions & 33 deletions Zend/zend_object_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,41 +63,24 @@ ZEND_API void rebuild_object_properties(zend_object *zobj) /* {{{ */
if (!zobj->properties) {
zend_property_info *prop_info;
zend_class_entry *ce = zobj->ce;
uint32_t flags = 0;
int i;

zobj->properties = zend_new_array(ce->default_properties_count);
if (ce->default_properties_count) {
zend_hash_real_init_mixed(zobj->properties);
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (!(prop_info->flags & ZEND_ACC_STATIC)) {
flags |= prop_info->flags;
for (i = 0; i < ce->default_properties_count; i++) {
prop_info = ce->properties_info_table[i];

if (UNEXPECTED(Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) == IS_UNDEF)) {
HT_FLAGS(zobj->properties) |= HASH_FLAG_HAS_EMPTY_IND;
}

_zend_hash_append_ind(zobj->properties, prop_info->name,
OBJ_PROP(zobj, prop_info->offset));
if (!prop_info) {
continue;
}
} ZEND_HASH_FOREACH_END();
if (flags & ZEND_ACC_CHANGED) {
while (ce->parent && ce->parent->default_properties_count) {
ce = ce->parent;
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (prop_info->ce == ce &&
!(prop_info->flags & ZEND_ACC_STATIC) &&
(prop_info->flags & ZEND_ACC_PRIVATE)) {
zval zv;

if (UNEXPECTED(Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) == IS_UNDEF)) {
HT_FLAGS(zobj->properties) |= HASH_FLAG_HAS_EMPTY_IND;
}

ZVAL_INDIRECT(&zv, OBJ_PROP(zobj, prop_info->offset));
zend_hash_add(zobj->properties, prop_info->name, &zv);
}
} ZEND_HASH_FOREACH_END();

if (UNEXPECTED(Z_TYPE_P(OBJ_PROP(zobj, prop_info->offset)) == IS_UNDEF)) {
HT_FLAGS(zobj->properties) |= HASH_FLAG_HAS_EMPTY_IND;
}

_zend_hash_append_ind(zobj->properties, prop_info->name,
OBJ_PROP(zobj, prop_info->offset));
}
}
}
Expand Down Expand Up @@ -1555,6 +1538,7 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
}
if (!zobj1->properties && !zobj2->properties) {
zend_property_info *info;
int i;

if (!zobj1->ce->default_properties_count) {
return 0;
Expand All @@ -1570,14 +1554,18 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
}
Z_PROTECT_RECURSION_P(o1);

ZEND_HASH_FOREACH_PTR(&zobj1->ce->properties_info, info) {
zval *p1 = OBJ_PROP(zobj1, info->offset);
zval *p2 = OBJ_PROP(zobj2, info->offset);
for (i = 0; i < zobj1->ce->default_properties_count; i++) {
zval *p1, *p2;

info = zobj1->ce->properties_info_table[i];

if (info->flags & ZEND_ACC_STATIC) {
if (!info) {
continue;
}

p1 = OBJ_PROP(zobj1, info->offset);
p2 = OBJ_PROP(zobj2, info->offset);

if (Z_TYPE_P(p1) != IS_UNDEF) {
if (Z_TYPE_P(p2) != IS_UNDEF) {
int ret;
Expand All @@ -1597,7 +1585,7 @@ ZEND_API int zend_std_compare_objects(zval *o1, zval *o2) /* {{{ */
return 1;
}
}
} ZEND_HASH_FOREACH_END();
}

Z_UNPROTECT_RECURSION_P(o1);
return 0;
Expand Down
16 changes: 8 additions & 8 deletions ext/date/tests/DateTimeZone_clone_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,28 @@ object(DateTimeZoneExt1)#%d (4) {
string(13) "Europe/London"
}
object(DateTimeZoneExt2)#%d (6) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["timezone_type"]=>
int(3)
["timezone"]=>
string(13) "Europe/London"
}
object(DateTimeZoneExt2)#%d (6) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["timezone_type"]=>
int(3)
["timezone"]=>
Expand Down
16 changes: 8 additions & 8 deletions ext/date/tests/DateTime_clone_basic2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ object(DateTimeExt1)#%d (5) {
string(3) "GMT"
}
object(DateTimeExt2)#%d (7) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["date"]=>
string(26) "2009-02-03 12:34:41.000000"
["timezone_type"]=>
Expand All @@ -71,14 +71,14 @@ object(DateTimeExt2)#%d (7) {
string(3) "GMT"
}
object(DateTimeExt2)#%d (7) {
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["property1"]=>
int(99)
["property2"]=>
string(5) "Hello"
["property3"]=>
bool(true)
["property4"]=>
float(10.5)
["date"]=>
string(26) "2009-02-03 12:34:41.000000"
["timezone_type"]=>
Expand Down
4 changes: 2 additions & 2 deletions ext/dom/tests/dom003.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ object(DOMException)#%d (%d) {
string(23) "Hierarchy Request Error"
["string":"Exception":private]=>
string(0) ""
["code"]=>
int(3)
["file":protected]=>
string(%d) "%sdom003.php"
["line":protected]=>
Expand Down Expand Up @@ -57,8 +59,6 @@ object(DOMException)#%d (%d) {
}
["previous":"Exception":private]=>
NULL
["code"]=>
int(3)
}
--- Don't catch exception with try/catch

Expand Down
4 changes: 2 additions & 2 deletions ext/dom/tests/dom_set_attr_node.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ object(DOMException)#%d (7) {
string(20) "Wrong Document Error"
["string":"Exception":private]=>
string(0) ""
["code"]=>
int(4)
["file":protected]=>
string(%d) "%sdom_set_attr_node.php"
["line":protected]=>
Expand Down Expand Up @@ -67,6 +69,4 @@ object(DOMException)#%d (7) {
}
["previous":"Exception":private]=>
NULL
["code"]=>
int(4)
}
12 changes: 6 additions & 6 deletions ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -291,23 +291,23 @@ string(1) "a"
reference, object, forward declaration...
int(1)
object(bar)#%d (2) {
["bar"]=>
&string(1) "a"
["foo"]=>
&string(1) "a"
["bar"]=>
&string(1) "a"
}
string(1) "a"
references, object, private...
int(1)
string(1) "a"
object(mega_bar)#5 (4) {
["foo"]=>
&string(1) "a"
["bar"]=>
&string(1) "a"
[%s]=>
&int(1)
["id_ref"]=>
&int(1)
["bar"]=>
&string(1) "a"
["foo"]=>
&string(1) "a"
}
done!
12 changes: 6 additions & 6 deletions ext/pdo/tests/pdo_005.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -114,40 +114,40 @@ TestDerived::__construct(2,3)
array(3) {
[0]=>
object(TestDerived)#%d (5) {
["row":protected]=>
int(0)
["id"]=>
string(1) "1"
["val":protected]=>
string(1) "A"
["val2":"TestBase":private]=>
NULL
["row":protected]=>
int(0)
["val2"]=>
string(2) "AA"
}
[1]=>
object(TestDerived)#%d (5) {
["row":protected]=>
int(1)
["id"]=>
string(1) "2"
["val":protected]=>
string(1) "B"
["val2":"TestBase":private]=>
NULL
["row":protected]=>
int(1)
["val2"]=>
string(2) "BB"
}
[2]=>
object(TestDerived)#%d (5) {
["row":protected]=>
int(2)
["id"]=>
string(1) "3"
["val":protected]=>
string(1) "C"
["val2":"TestBase":private]=>
NULL
["row":protected]=>
int(2)
["val2"]=>
string(2) "CC"
}
Expand Down
Loading