File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 11--TEST--
2- PHPC-1005 : Do not modify memory of Persistable::bsonSerialize() return value
2+ PHPC-1006 : Do not modify memory of Persistable::bsonSerialize() return value
33--FILE--
44<?php
55
Original file line number Diff line number Diff line change 1+ --TEST--
2+ PHPC-1006: Do not skip __pclass in Serializable::bsonSerialize() return value
3+ --FILE--
4+ <?php
5+
6+ require_once __DIR__ . '/../utils/tools.php ' ;
7+
8+ class MyClass implements MongoDB \BSON \Serializable
9+ {
10+ function bsonSerialize ()
11+ {
12+ return [
13+ '__pclass ' => 'baz ' ,
14+ 'foo ' => 'bar ' ,
15+ ];
16+ }
17+ }
18+
19+ hex_dump (fromPHP (new MyClass ));
20+
21+ ?>
22+ ===DONE===
23+ <?php exit (0 ); ?>
24+ --EXPECT--
25+ 0 : 24 00 00 00 02 5f 5f 70 63 6c 61 73 73 00 04 00 [$....__pclass...]
26+ 10 : 00 00 62 61 7a 00 02 66 6f 6f 00 04 00 00 00 62 [..baz..foo.....b]
27+ 20 : 61 72 00 00 [ar..]
28+ ===DONE===
You can’t perform that action at this time.
0 commit comments