File: issue080.phpt

package info (click to toggle)
php-msgpack 2.1.2%2B0.5.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,544 kB
  • sloc: ansic: 7,749; xml: 800; php: 18; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
Issue #80 (Serialized failed on unseted value)
--SKIPIF--
<?php
if (!extension_loaded("msgpack")) {
   echo "skip";
}
--FILE--
<?php

class MyClass
{
    protected $field;

    public function preSerialize()
    {
        unset($this->field);
    }
}

$t = new MyClass();
$t->preSerialize();
var_dump(msgpack_unserialize(msgpack_serialize($t)));
?>
--EXPECTF--
object(MyClass)#%d (1) {
  ["field":protected]=>
  NULL
}