Created
June 1, 2015 04:09
-
-
Save Sean-Der/f8cb8578f195dc563414 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ZEND_FUNCTION(msgpack_unserialize){ | |
zval *object, *bool_val, *ref_val; | |
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &object) == FAILURE) { | |
return; | |
} | |
ALLOC_INIT_ZVAL(bool_val); | |
ZVAL_BOOL(bool_val, true); | |
ALLOC_INIT_ZVAL(ref_val); | |
array_init(ref_val); | |
Z_SET_ISREF_P(ref_val); | |
Z_ADDREF_PP(&ref_val); | |
zend_symtable_update(HASH_OF(object), "", sizeof(""), &bool_val, sizeof(bool_val), NULL); | |
zend_symtable_update(HASH_OF(object), "ref_val", sizeof("ref_val"), &ref_val, sizeof(ref_val), NULL); | |
zend_hash_index_update(HASH_OF(object), 4, &bool_val, sizeof(bool_val), NULL); | |
} | |
<?php | |
error_reporting(0); | |
class Obj { | |
} | |
$obj = new Obj(); | |
msgpack_unserialize($obj); | |
var_dump($obj); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment