Skip to content

Use own definition of msgpack_unserialize_data_t #104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ language: php

php:
- 7.0
- 7.1

matrix:
fast_finish: true
allow_failures:
- php: 7.1

notifications:
email: false
Expand Down
8 changes: 7 additions & 1 deletion msgpack_unpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ typedef enum
MSGPACK_UNPACK_PARSE_ERROR = -1,
} msgpack_unpack_return;

typedef struct php_unserialize_data msgpack_unserialize_data_t;
typedef struct _msgpack_unserialize_data {
void *first;
void *last;
void *first_dtor;
void *last_dtor;
HashTable *allowed_classes;
} msgpack_unserialize_data_t;

typedef struct {
zval *retval;
Expand Down
2 changes: 1 addition & 1 deletion tests/034.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ foreach ($datas as $data)
for ($i = 0; $i < $len - 1; $i++)
{
$sub = substr($str, 0, $i);
$sub .= mcrypt_create_iv(30, MCRYPT_DEV_URANDOM);
$sub .= random_bytes(30);
$php_errormsg = null;
$v = msgpack_unserialize($sub);
}
Expand Down
7 changes: 1 addition & 6 deletions tests/035.phpt
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
--TEST--
Profiling perf test.
--SKIPIF--
<?php
if (!extension_loaded("msgpack") || !extension_loaded("mcrypt")) {
echo "skip";
}
?>
--FILE--
<?php
$data_array = array();
for ($i = 0; $i < 5000; $i++) {
$data_array[mcrypt_create_iv(10, MCRYPT_DEV_URANDOM)] = mcrypt_create_iv(10, MCRYPT_DEV_URANDOM);
$data_array[random_bytes(10)] = random_bytes(10);
}

$time_start = microtime(true);
Expand Down
6 changes: 3 additions & 3 deletions tests/041.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ float(0)
cb0000000000000000

double -0.0:
float(0)
float(0)
cb0000000000000000
float(-0)
float(-0)
cb8000000000000000