Skip to content

Commit 11648c0

Browse files
committed
Don't include object hash in SplObjectStorage debug dump
The object hash is not particularly useful (anymore) and just clutters the output. It encodes the same information as the object ID, which is already part of the output.
1 parent 485a42f commit 11648c0

10 files changed

+38
-41
lines changed

ext/spl/spl_observer.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ static inline HashTable* spl_object_storage_debug_info(zend_object *obj) /* {{{
247247
spl_SplObjectStorageElement *element;
248248
HashTable *props;
249249
zval tmp, storage;
250-
zend_string *md5str;
251250
zend_string *zname;
252251
HashTable *debug_info;
253252

@@ -259,7 +258,6 @@ static inline HashTable* spl_object_storage_debug_info(zend_object *obj) /* {{{
259258
array_init(&storage);
260259

261260
ZEND_HASH_FOREACH_PTR(&intern->storage, element) {
262-
md5str = php_spl_object_hash(element->obj);
263261
array_init(&tmp);
264262
/* Incrementing the refcount of obj and inf would confuse the garbage collector.
265263
* Prefer to null the destructor */
@@ -268,8 +266,7 @@ static inline HashTable* spl_object_storage_debug_info(zend_object *obj) /* {{{
268266
ZVAL_OBJ(&obj, element->obj);
269267
add_assoc_zval_ex(&tmp, "obj", sizeof("obj") - 1, &obj);
270268
add_assoc_zval_ex(&tmp, "inf", sizeof("inf") - 1, &element->inf);
271-
zend_hash_update(Z_ARRVAL(storage), md5str, &tmp);
272-
zend_string_release_ex(md5str, 0);
269+
zend_hash_next_index_insert(Z_ARRVAL(storage), &tmp);
273270
} ZEND_HASH_FOREACH_END();
274271

275272
zname = spl_gen_private_prop_name(spl_ce_SplObjectStorage, "storage", sizeof("storage")-1);

ext/spl/tests/SplObjectStorage_unserialize_bad.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ try {
2020
}
2121
echo "DONE\n";
2222
?>
23-
--EXPECTF--
23+
--EXPECT--
2424
Error at offset 6 of 34 bytes
2525
Error at offset 46 of 89 bytes
2626
object(SplObjectStorage)#2 (1) {
2727
["storage":"SplObjectStorage":private]=>
2828
array(2) {
29-
["%s"]=>
29+
[0]=>
3030
array(2) {
3131
["obj"]=>
3232
object(stdClass)#3 (0) {
3333
}
3434
["inf"]=>
3535
int(1)
3636
}
37-
["%s"]=>
37+
[1]=>
3838
array(2) {
3939
["obj"]=>
4040
object(stdClass)#1 (0) {

ext/spl/tests/SplObjectStorage_unserialize_nested.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ echo $s."\n";
1818
$so1 = unserialize($s);
1919
var_dump($so1);
2020
?>
21-
--EXPECTF--
21+
--EXPECT--
2222
O:16:"SplObjectStorage":2:{i:0;a:4:{i:0;O:8:"stdClass":1:{s:1:"a";O:8:"stdClass":0:{}}i:1;i:1;i:2;r:4;i:3;i:2;}i:1;a:0:{}}
2323
object(SplObjectStorage)#4 (1) {
2424
["storage":"SplObjectStorage":private]=>
2525
array(2) {
26-
["%s"]=>
26+
[0]=>
2727
array(2) {
2828
["obj"]=>
2929
object(stdClass)#5 (1) {
@@ -34,7 +34,7 @@ object(SplObjectStorage)#4 (1) {
3434
["inf"]=>
3535
int(1)
3636
}
37-
["%s"]=>
37+
[1]=>
3838
array(2) {
3939
["obj"]=>
4040
object(stdClass)#6 (0) {

ext/spl/tests/SplObjectStorage_var_dump.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var_dump($o);
1111
object(SplObjectStorage)#%d (1) {
1212
["storage":"SplObjectStorage":private]=>
1313
array(1) {
14-
["%s"]=>
14+
[0]=>
1515
array(2) {
1616
["obj"]=>
1717
object(stdClass)#%d (0) {

ext/spl/tests/bug49263.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ unset($s,$o1,$o2);
1515
echo $ss."\n";
1616
var_dump(unserialize($ss));
1717
?>
18-
--EXPECTF--
18+
--EXPECT--
1919
O:16:"SplObjectStorage":2:{i:0;a:4:{i:0;O:8:"stdClass":0:{}i:1;a:2:{s:4:"prev";i:2;s:4:"next";O:8:"stdClass":0:{}}i:2;r:6;i:3;a:1:{s:4:"prev";r:3;}}i:1;a:0:{}}
2020
object(SplObjectStorage)#2 (1) {
2121
["storage":"SplObjectStorage":private]=>
2222
array(2) {
23-
["%s"]=>
23+
[0]=>
2424
array(2) {
2525
["obj"]=>
2626
object(stdClass)#1 (0) {
@@ -34,7 +34,7 @@ object(SplObjectStorage)#2 (1) {
3434
}
3535
}
3636
}
37-
["%s"]=>
37+
[1]=>
3838
array(2) {
3939
["obj"]=>
4040
object(stdClass)#3 (0) {

ext/spl/tests/bug70168.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ array(2) {
1919
object(SplObjectStorage)#%d (1) {
2020
["storage":"SplObjectStorage":private]=>
2121
array(1) {
22-
["%s"]=>
22+
[0]=>
2323
array(2) {
2424
["obj"]=>
2525
object(stdClass)#2 (0) {

ext/spl/tests/observer_004.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ object(MyStorage)#%d (2) {
6363
int(26)
6464
["storage":"SplObjectStorage":private]=>
6565
array(2) {
66-
["%s"]=>
66+
[0]=>
6767
array(2) {
6868
["obj"]=>
6969
object(TestClass)#%d (1) {
@@ -73,7 +73,7 @@ object(MyStorage)#%d (2) {
7373
["inf"]=>
7474
NULL
7575
}
76-
["%s"]=>
76+
[1]=>
7777
array(2) {
7878
["obj"]=>
7979
object(TestClass)#%d (1) {
@@ -95,7 +95,7 @@ object(MyStorage)#%d (2) {
9595
int(26)
9696
["storage":"SplObjectStorage":private]=>
9797
array(2) {
98-
["%s"]=>
98+
[0]=>
9999
array(2) {
100100
["obj"]=>
101101
object(TestClass)#%d (1) {
@@ -105,7 +105,7 @@ object(MyStorage)#%d (2) {
105105
["inf"]=>
106106
NULL
107107
}
108-
["%s"]=>
108+
[1]=>
109109
array(2) {
110110
["obj"]=>
111111
object(TestClass)#%d (1) {

ext/spl/tests/observer_005.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ object(MyStorage)#%d (5) {
105105
int(3)
106106
["storage":"SplObjectStorage":private]=>
107107
array(2) {
108-
["%s"]=>
108+
[0]=>
109109
array(2) {
110110
["obj"]=>
111111
object(TestClass)#%d (4) {
@@ -121,7 +121,7 @@ object(MyStorage)#%d (5) {
121121
["inf"]=>
122122
NULL
123123
}
124-
["%s"]=>
124+
[1]=>
125125
array(2) {
126126
["obj"]=>
127127
object(TestClass)#%d (4) {
@@ -173,7 +173,7 @@ object(MyStorage)#%d (5) {
173173
int(3)
174174
["storage":"SplObjectStorage":private]=>
175175
array(2) {
176-
["%s"]=>
176+
[0]=>
177177
array(2) {
178178
["obj"]=>
179179
object(TestClass)#%d (4) {
@@ -189,7 +189,7 @@ object(MyStorage)#%d (5) {
189189
["inf"]=>
190190
NULL
191191
}
192-
["%s"]=>
192+
[1]=>
193193
array(2) {
194194
["obj"]=>
195195
object(TestClass)#%d (4) {

ext/spl/tests/observer_006.phpt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ object(MyStorage)#%d (2) {
8484
int(26)
8585
["storage":"SplObjectStorage":private]=>
8686
array(2) {
87-
["%s"]=>
87+
[0]=>
8888
array(2) {
8989
["obj"]=>
9090
object(TestClass)#%d (1) {
@@ -94,7 +94,7 @@ object(MyStorage)#%d (2) {
9494
["inf"]=>
9595
string(3) "foo"
9696
}
97-
["%s"]=>
97+
[1]=>
9898
array(2) {
9999
["obj"]=>
100100
object(TestClass)#%d (1) {
@@ -116,7 +116,7 @@ object(MyStorage)#%d (2) {
116116
int(26)
117117
["storage":"SplObjectStorage":private]=>
118118
array(2) {
119-
["%s"]=>
119+
[0]=>
120120
array(2) {
121121
["obj"]=>
122122
object(TestClass)#%d (1) {
@@ -126,7 +126,7 @@ object(MyStorage)#%d (2) {
126126
["inf"]=>
127127
string(3) "foo"
128128
}
129-
["%s"]=>
129+
[1]=>
130130
array(2) {
131131
["obj"]=>
132132
object(TestClass)#%d (1) {
@@ -144,7 +144,7 @@ object(MyStorage)#%d (2) {
144144
int(26)
145145
["storage":"SplObjectStorage":private]=>
146146
array(4) {
147-
["%s"]=>
147+
[0]=>
148148
array(2) {
149149
["obj"]=>
150150
object(TestClass)#%d (1) {
@@ -154,7 +154,7 @@ object(MyStorage)#%d (2) {
154154
["inf"]=>
155155
string(3) "foo"
156156
}
157-
["%s"]=>
157+
[1]=>
158158
array(2) {
159159
["obj"]=>
160160
object(TestClass)#%d (1) {
@@ -164,7 +164,7 @@ object(MyStorage)#%d (2) {
164164
["inf"]=>
165165
int(42)
166166
}
167-
["%s"]=>
167+
[2]=>
168168
array(2) {
169169
["obj"]=>
170170
object(TestClass)#%d (1) {
@@ -175,7 +175,7 @@ object(MyStorage)#%d (2) {
175175
object(stdClass)#%d (0) {
176176
}
177177
}
178-
["%s"]=>
178+
[3]=>
179179
array(2) {
180180
["obj"]=>
181181
object(TestClass)#%d (1) {
@@ -203,7 +203,7 @@ object(MyStorage)#%d (2) {
203203
int(26)
204204
["storage":"SplObjectStorage":private]=>
205205
array(4) {
206-
["%s"]=>
206+
[0]=>
207207
array(2) {
208208
["obj"]=>
209209
object(TestClass)#%d (1) {
@@ -213,7 +213,7 @@ object(MyStorage)#%d (2) {
213213
["inf"]=>
214214
string(3) "foo"
215215
}
216-
["%s"]=>
216+
[1]=>
217217
array(2) {
218218
["obj"]=>
219219
object(TestClass)#%d (1) {
@@ -223,7 +223,7 @@ object(MyStorage)#%d (2) {
223223
["inf"]=>
224224
string(3) "bar"
225225
}
226-
["%s"]=>
226+
[2]=>
227227
array(2) {
228228
["obj"]=>
229229
object(TestClass)#%d (1) {
@@ -234,7 +234,7 @@ object(MyStorage)#%d (2) {
234234
object(stdClass)#%d (0) {
235235
}
236236
}
237-
["%s"]=>
237+
[3]=>
238238
array(2) {
239239
["obj"]=>
240240
object(TestClass)#%d (1) {
@@ -260,7 +260,7 @@ object(MyStorage)#%d (2) {
260260
int(26)
261261
["storage":"SplObjectStorage":private]=>
262262
array(4) {
263-
["%s"]=>
263+
[0]=>
264264
array(2) {
265265
["obj"]=>
266266
object(TestClass)#%d (1) {
@@ -270,7 +270,7 @@ object(MyStorage)#%d (2) {
270270
["inf"]=>
271271
string(3) "foo"
272272
}
273-
["%s"]=>
273+
[1]=>
274274
array(2) {
275275
["obj"]=>
276276
object(TestClass)#%d (1) {
@@ -280,7 +280,7 @@ object(MyStorage)#%d (2) {
280280
["inf"]=>
281281
string(3) "bar"
282282
}
283-
["%s"]=>
283+
[2]=>
284284
array(2) {
285285
["obj"]=>
286286
object(TestClass)#%d (1) {
@@ -290,7 +290,7 @@ object(MyStorage)#%d (2) {
290290
["inf"]=>
291291
string(8) "replaced"
292292
}
293-
["%s"]=>
293+
[3]=>
294294
array(2) {
295295
["obj"]=>
296296
object(TestClass)#%d (1) {

ext/standard/tests/serialize/SplObjectStorage_object_reference.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ STR;
1111
var_dump(unserialize($str));
1212

1313
?>
14-
--EXPECTF--
14+
--EXPECT--
1515
array(2) {
1616
[0]=>
1717
object(SplObjectStorage)#1 (1) {
1818
["storage":"SplObjectStorage":private]=>
1919
array(1) {
20-
["%s"]=>
20+
[0]=>
2121
array(2) {
2222
["obj"]=>
2323
object(stdClass)#2 (0) {

0 commit comments

Comments
 (0)