����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 :  /usr/share/tests/pecl/msgpack/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/tests/pecl/msgpack/tests/bug013.phpt
--TEST--
Bug #13 (ensure that __get/__set aren't called when packing/unpacking)
--SKIPIF--
<?php
if (!extension_loaded("msgpack")) {
   echo "skip";
}
--FILE--
<?php

#[AllowDynamicProperties()]
class magicClass {
    public function __set($name, $value) {
        echo 'Called __set' . PHP_EOL;
        $this->$name = $value;
    }
    public function __get($name) {
        echo 'Called __get' . PHP_EOL;
        return $this->$name;
    }
}

$magicInstance = new \magicClass;
$magicInstance->val = 5;
var_dump($magicInstance);

$packed = msgpack_pack($magicInstance);
var_dump(bin2hex($packed));
$unpacked = msgpack_unpack($packed);
var_dump($unpacked);

?>
--EXPECTF--
Called __set
object(magicClass)#%d (1) {
  ["val"]=>
  int(5)
}
string(36) "82c0aa6d61676963436c617373a376616c05"
object(magicClass)#%d (1) {
  ["val"]=>
  int(5)
}

ZeroDay Forums Mini