summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PHPINFO2
-rw-r--r--REFLECTION20
-rw-r--r--msgpack-php8.patch628
-rw-r--r--php-pecl-msgpack.spec165
4 files changed, 103 insertions, 712 deletions
diff --git a/PHPINFO b/PHPINFO
index 0f687d8..49b3fe8 100644
--- a/PHPINFO
+++ b/PHPINFO
@@ -3,7 +3,7 @@ msgpack
MessagePack Support => enabled
Session Support => enabled
-extension Version => 2.1.1
+extension Version => 2.2.0
header Version => 3.2.0
Directive => Local Value => Master Value
diff --git a/REFLECTION b/REFLECTION
index e3be9ef..6298c67 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,4 +1,4 @@
-Extension [ <persistent> extension #86 msgpack version 2.1.1 ] {
+Extension [ <persistent> extension #85 msgpack version 2.2.0 ] {
- INI {
Entry [ msgpack.error_display <ALL> ]
@@ -30,7 +30,7 @@ Extension [ <persistent> extension #86 msgpack version 2.1.1 ] {
- Parameters [2] {
Parameter #0 [ <required> $str ]
- Parameter #1 [ <optional> $object ]
+ Parameter #1 [ <optional> $object = <default> ]
}
}
Function [ <internal:msgpack> function msgpack_pack ] {
@@ -43,7 +43,7 @@ Extension [ <persistent> extension #86 msgpack version 2.1.1 ] {
- Parameters [2] {
Parameter #0 [ <required> $str ]
- Parameter #1 [ <optional> $object ]
+ Parameter #1 [ <optional> $object = <default> ]
}
}
}
@@ -68,7 +68,7 @@ Extension [ <persistent> extension #86 msgpack version 2.1.1 ] {
Method [ <internal:msgpack, ctor> public method __construct ] {
- Parameters [1] {
- Parameter #0 [ <optional> $opt ]
+ Parameter #0 [ <optional> $opt = <default> ]
}
}
@@ -91,7 +91,7 @@ Extension [ <persistent> extension #86 msgpack version 2.1.1 ] {
- Parameters [2] {
Parameter #0 [ <required> $str ]
- Parameter #1 [ <optional> $object ]
+ Parameter #1 [ <optional> $object = <default> ]
}
}
@@ -121,11 +121,11 @@ Extension [ <persistent> extension #86 msgpack version 2.1.1 ] {
Method [ <internal:msgpack, ctor> public method __construct ] {
- Parameters [1] {
- Parameter #0 [ <optional> $opt ]
+ Parameter #0 [ <optional> $opt = <default> ]
}
}
- Method [ <internal:msgpack, dtor> public method __destruct ] {
+ Method [ <internal:msgpack> public method __destruct ] {
- Parameters [0] {
}
@@ -149,15 +149,15 @@ Extension [ <persistent> extension #86 msgpack version 2.1.1 ] {
Method [ <internal:msgpack> public method execute ] {
- Parameters [2] {
- Parameter #0 [ <optional> $str ]
- Parameter #1 [ <optional> &$offset ]
+ Parameter #0 [ <optional> $str = <default> ]
+ Parameter #1 [ <optional> &$offset = <default> ]
}
}
Method [ <internal:msgpack> public method data ] {
- Parameters [1] {
- Parameter #0 [ <optional> $object ]
+ Parameter #0 [ <optional> $object = <default> ]
}
}
diff --git a/msgpack-php8.patch b/msgpack-php8.patch
deleted file mode 100644
index 864692a..0000000
--- a/msgpack-php8.patch
+++ /dev/null
@@ -1,628 +0,0 @@
-From e3ef2010a9ffb8bcc46a3d5a5a93ad1b048e3f96 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Wed, 15 Apr 2020 16:58:27 +0200
-Subject: [PATCH] fix build with php 8
-
----
- msgpack_convert.c | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/msgpack_convert.c b/msgpack_convert.c
-index c89aff5..93e55b2 100644
---- a/msgpack_convert.c
-+++ b/msgpack_convert.c
-@@ -64,7 +64,15 @@ static inline int msgpack_convert_long_to_properties(HashTable *ht, zval *object
- *properties = NULL;
- }
- ZVAL_LONG(&key_zv, key_index);
-+#if PHP_VERSION_ID < 80000
- zend_std_write_property(object, &key_zv, val, NULL);
-+#else
-+ {
-+ zend_string *key = zval_get_string(&key_zv);
-+ zend_std_write_property(Z_OBJ_P(object), key, val, NULL);
-+ zend_string_release(key);
-+ }
-+#endif
- return SUCCESS;
- }
- /* }}} */
-@@ -87,7 +95,11 @@ static inline int msgpack_convert_string_to_properties(zval *object, zend_string
- zend_update_property_ex(ce, object, key, val);
- return_code = SUCCESS;
- } else {
-+#if PHP_VERSION_ID < 80000
- zend_std_write_property(object, &pub_name, val, NULL);
-+#else
-+ zend_std_write_property(Z_OBJ_P(object), key, val, NULL);
-+#endif
- return_code = FAILURE;
- }
- zend_hash_add(var, Z_STR(pub_name), val);
-@@ -358,7 +370,11 @@ int msgpack_convert_object(zval *return_value, zval *tpl, zval *value) /* {{{ */
- } ZEND_HASH_FOREACH_END();
-
- /* index */
-+#if PHP_VERSION_ID < 80000
- properties = Z_OBJ_HT_P(return_value)->get_properties(return_value);
-+#else
-+ properties = Z_OBJ_HT_P(return_value)->get_properties(Z_OBJ_P(return_value));
-+#endif
- if (HASH_OF(tpl)) {
- properties = HASH_OF(tpl);
- }
-@@ -433,7 +449,11 @@ int msgpack_convert_object(zval *return_value, zval *tpl, zval *value) /* {{{ */
- HashTable *properties = NULL;
- HashPosition prop_pos;
-
-+#if PHP_VERSION_ID < 80000
- properties = Z_OBJ_HT_P(return_value)->get_properties(return_value);
-+#else
-+ properties = Z_OBJ_HT_P(return_value)->get_properties(Z_OBJ_P(return_value));
-+#endif
- zend_hash_internal_pointer_reset_ex(properties, &prop_pos);
-
- if (msgpack_convert_long_to_properties(HASH_OF(return_value), return_value, &properties, &prop_pos, 0, value, NULL) != SUCCESS) {
-From f933cf5df92dbb2da8665905f1f44317f62a4765 Mon Sep 17 00:00:00 2001
-From: Michael Wallner <mike@php.net>
-Date: Fri, 31 Jul 2020 06:51:51 +0200
-Subject: [PATCH] remove interned strings optimization causing exhaustive
- memory usage
-
-fixes #153 and possibly fixes #147
----
- msgpack_unpack.c | 10 +---------
- 1 file changed, 1 insertion(+), 9 deletions(-)
-
-diff --git a/msgpack_unpack.c b/msgpack_unpack.c
-index c743078..8dc9480 100644
---- a/msgpack_unpack.c
-+++ b/msgpack_unpack.c
-@@ -12,9 +12,6 @@
- #if PHP_VERSION_ID < 70400
- # define zval_try_get_string zval_get_string
- #endif
--#if PHP_VERSION_ID < 70200
--# define zend_string_init_interned zend_string_init
--#endif
-
- typedef struct {
- zend_long used_slots;
-@@ -523,12 +520,7 @@ int msgpack_unserialize_str(msgpack_unserialize_data *unpack, const char* base,
- ZVAL_EMPTY_STRING(*obj);
- } else {
- /* TODO: check malformed input? */
-- if (len < 1<<8) {
-- zend_string *zs = zend_string_init_interned(data, len, 0);
-- ZVAL_STR(*obj, zs);
-- } else {
-- ZVAL_STRINGL(*obj, data, len);
-- }
-+ ZVAL_STRINGL(*obj, data, len);
- }
-
- return 0;
-From 780b0b457693180f5f8a82ef1aef02f23f322e03 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Thu, 3 Sep 2020 09:37:26 +0200
-Subject: [PATCH] more fix for PHP 8
-
----
- msgpack_class.c | 2 +-
- msgpack_convert.c | 17 +++++++++--------
- msgpack_pack.c | 4 ++--
- msgpack_unpack.c | 8 ++++++--
- php_msgpack.h | 6 ++++++
- 5 files changed, 24 insertions(+), 13 deletions(-)
-
-diff --git a/msgpack_class.c b/msgpack_class.c
-index 69f3803..1b0ffe7 100644
---- a/msgpack_class.c
-+++ b/msgpack_class.c
-@@ -274,7 +274,7 @@ static ZEND_METHOD(msgpack, unpacker) /* {{{ */ {
- ZVAL_STRING(&func_name, "__construct");
-
- object_init_ex(return_value, msgpack_unpacker_ce);
-- call_user_function_ex(CG(function_table), return_value, &func_name, &construct_return, 1, args, 0, NULL);
-+ call_user_function(CG(function_table), return_value, &func_name, &construct_return, 1, args);
-
- zval_ptr_dtor(&func_name);
- }
-diff --git a/msgpack_convert.c b/msgpack_convert.c
-index 93e55b2..8f9e1d0 100644
---- a/msgpack_convert.c
-+++ b/msgpack_convert.c
-@@ -36,7 +36,7 @@ static inline int msgpack_convert_long_to_properties(HashTable *ht, zval *object
-
- if (msgpack_convert_array(&tplval, data, dataval) == SUCCESS) {
- zend_hash_move_forward_ex(props, prop_pos);
-- zend_update_property(Z_OBJCE_P(object), object, prop_name, prop_len, &tplval);
-+ zend_update_property(Z_OBJCE_P(object), OBJ_FOR_PROP(object), prop_name, prop_len, &tplval);
- return SUCCESS;
- }
- return FAILURE;
-@@ -45,14 +45,14 @@ static inline int msgpack_convert_long_to_properties(HashTable *ht, zval *object
- {
- if (msgpack_convert_object(&tplval, data, val) == SUCCESS) {
- zend_hash_move_forward_ex(props, prop_pos);
-- zend_update_property(Z_OBJCE_P(object), object, prop_name, prop_len, &tplval);
-+ zend_update_property(Z_OBJCE_P(object), OBJ_FOR_PROP(object), prop_name, prop_len, &tplval);
- return SUCCESS;
- }
- return FAILURE;
- }
- default:
- zend_hash_move_forward_ex(props, prop_pos);
-- zend_update_property(Z_OBJCE_P(object), object, prop_name, prop_len, val);
-+ zend_update_property(Z_OBJCE_P(object), OBJ_FOR_PROP(object), prop_name, prop_len, val);
- return SUCCESS;
- }
- }
-@@ -89,10 +89,10 @@ static inline int msgpack_convert_string_to_properties(zval *object, zend_string
- prot_name = zend_mangle_property_name("*", 1, ZSTR_VAL(key), ZSTR_LEN(key), 1);
-
- if (zend_hash_find(propers, priv_name) != NULL) {
-- zend_update_property_ex(ce, object, key, val);
-+ zend_update_property_ex(ce, OBJ_FOR_PROP(object), key, val);
- return_code = SUCCESS;
- } else if (zend_hash_find(propers, prot_name) != NULL) {
-- zend_update_property_ex(ce, object, key, val);
-+ zend_update_property_ex(ce, OBJ_FOR_PROP(object), key, val);
- return_code = SUCCESS;
- } else {
- #if PHP_VERSION_ID < 80000
-@@ -310,8 +310,9 @@ int msgpack_convert_object(zval *return_value, zval *tpl, zval *value) /* {{{ */
- fci.retval = &retval;
- fci.param_count = 0;
- fci.params = &params;
-+#if PHP_VERSION_ID < 80000
- fci.no_separation = 1;
--
-+#endif
- #if PHP_VERSION_ID < 70300
- fcc.initialized = 1;
- #endif
-@@ -434,10 +435,10 @@ int msgpack_convert_object(zval *return_value, zval *tpl, zval *value) /* {{{ */
- return FAILURE;
- }
-
-- zend_update_property_ex(ce, return_value, str_key, &nv);
-+ zend_update_property_ex(ce, OBJ_FOR_PROP(return_value), str_key, &nv);
- zval_ptr_dtor(&nv);
- } else {
-- zend_update_property(ce, return_value, prop_name, prop_len, aryval);
-+ zend_update_property(ce, OBJ_FOR_PROP(return_value), prop_name, prop_len, aryval);
- }
- num_key++;
- } ZEND_HASH_FOREACH_END();
-diff --git a/msgpack_pack.c b/msgpack_pack.c
-index c5da6d9..f9d1ad0 100644
---- a/msgpack_pack.c
-+++ b/msgpack_pack.c
-@@ -223,7 +223,7 @@ static inline void msgpack_serialize_array(smart_str *buf, zval *val, HashTable
- if (object) {
- #if PHP_VERSION_ID >= 70400
- if (Z_OBJ_HANDLER_P(val, get_properties_for)) {
-- ht = Z_OBJ_HANDLER_P(val, get_properties_for)(val, ZEND_PROP_PURPOSE_ARRAY_CAST);
-+ ht = Z_OBJ_HANDLER_P(val, get_properties_for)(OBJ_FOR_PROP(val), ZEND_PROP_PURPOSE_ARRAY_CAST);
- free_ht = 1;
- } else {
- ht = Z_OBJPROP_P(val);
-@@ -409,7 +409,7 @@ static inline void msgpack_serialize_object(smart_str *buf, zval *val, HashTable
-
- if (ce && ce != PHP_IC_ENTRY &&
- zend_hash_exists(&ce->function_table, sleep_zstring)) {
-- if ((res = call_user_function_ex(CG(function_table), val_noref, &fname, &retval, 0, 0, 1, NULL)) == SUCCESS) {
-+ if ((res = call_user_function(CG(function_table), val_noref, &fname, &retval, 0, 0)) == SUCCESS) {
-
- if (EG(exception)) {
- zval_ptr_dtor(&retval);
-diff --git a/msgpack_unpack.c b/msgpack_unpack.c
-index 9ce1961..a602c52 100644
---- a/msgpack_unpack.c
-+++ b/msgpack_unpack.c
-@@ -282,7 +282,7 @@ static zend_class_entry* msgpack_unserialize_class(zval **container, zend_string
- ZVAL_STRING(&user_func, PG(unserialize_callback_func));
- ZVAL_STR(&args[0], class_name);
-
-- func_call_status = call_user_function_ex(CG(function_table), NULL, &user_func, &retval, 1, args, 0, NULL);
-+ func_call_status = call_user_function(CG(function_table), NULL, &user_func, &retval, 1, args);
- zval_ptr_dtor(&user_func);
- if (func_call_status != SUCCESS) {
- MSGPACK_WARNING("[msgpack] (%s) defined (%s) but not found",
-@@ -329,7 +329,11 @@ static zend_class_entry* msgpack_unserialize_class(zval **container, zend_string
-
- /* store incomplete class name */
- if (incomplete_class) {
-+#if PHP_VERSION_ID < 80000
- php_store_class_name(container_val, ZSTR_VAL(class_name), ZSTR_LEN(class_name));
-+#else
-+ php_store_class_name(container_val, class_name);
-+#endif
- }
-
- return ce;
-@@ -836,7 +840,7 @@ int msgpack_unserialize_map_item(msgpack_unserialize_data *unpack, zval **contai
- zend_hash_str_exists(&Z_OBJCE_P(container_val)->function_table, "__wakeup", sizeof("__wakeup") - 1)) {
- zval wakeup, r;
- ZVAL_STRING(&wakeup, "__wakeup");
-- call_user_function_ex(CG(function_table), container_val, &wakeup, &r, 0, NULL, 1, NULL);
-+ call_user_function(CG(function_table), container_val, &wakeup, &r, 0, NULL);
- zval_ptr_dtor(&r);
- zval_ptr_dtor(&wakeup);
- }
-diff --git a/php_msgpack.h b/php_msgpack.h
-index d5f9164..6ecd5f4 100644
---- a/php_msgpack.h
-+++ b/php_msgpack.h
-@@ -52,4 +52,10 @@ PHP_MSGPACK_API int php_msgpack_unserialize(
- # define MSGPACK_ENDIAN_BIG_BYTE 0
- #endif
-
-+#if PHP_VERSION_ID < 80000
-+# define OBJ_FOR_PROP(zv) (zv)
-+#else
-+# define OBJ_FOR_PROP(zv) Z_OBJ_P(zv)
-+#endif
-+
- #endif /* PHP_MSGPACK_H */
-From 77368369d8c9b7a9f135d3b6aef2c26656dd4b55 Mon Sep 17 00:00:00 2001
-From: Michael Wallner <mike@php.net>
-Date: Wed, 23 Sep 2020 09:13:30 +0200
-Subject: [PATCH] msgpack_convert: fix crash on callback with PHP 8
-
----
- msgpack_convert.c | 11 +++++------
- 1 file changed, 5 insertions(+), 6 deletions(-)
-
-diff --git a/msgpack_convert.c b/msgpack_convert.c
-index 8f9e1d0..1f90ef4 100644
---- a/msgpack_convert.c
-+++ b/msgpack_convert.c
-@@ -296,28 +296,27 @@ int msgpack_convert_object(zval *return_value, zval *tpl, zval *value) /* {{{ */
-
- /* Run the constructor if there is one */
- if (ce->constructor && (ce->constructor->common.fn_flags & ZEND_ACC_PUBLIC)) {
-- zval retval, params, function_name;
-+ zval retval;
- zend_fcall_info fci;
- zend_fcall_info_cache fcc;
-
-+ memset(&fci, 0, sizeof(fci));
-+ memset(&fcc, 0, sizeof(fcc));
-+
- fci.size = sizeof(fci);
- #if PHP_VERSION_ID < 70100
- fci.function_table = EG(function_table);
-- fci.symbol_table = NULL;
- #endif
-- fci.function_name = function_name;
- fci.object = Z_OBJ_P(return_value);
- fci.retval = &retval;
-- fci.param_count = 0;
-- fci.params = &params;
- #if PHP_VERSION_ID < 80000
- fci.no_separation = 1;
- #endif
-+
- #if PHP_VERSION_ID < 70300
- fcc.initialized = 1;
- #endif
- fcc.function_handler = ce->constructor;
--
- #if PHP_VERSION_ID < 70100
- fcc.calling_scope = EG(scope);
- #else
-From 87e0424e81e9187e39b3d1e7e4d1bb47a94d95e0 Mon Sep 17 00:00:00 2001
-From: Michael Wallner <mike@php.net>
-Date: Wed, 23 Sep 2020 09:36:34 +0200
-Subject: [PATCH] tests: do not depend on ext/curl for a simple resource
-
----
- tests/023.phpt | 18 ++----------------
- 1 file changed, 2 insertions(+), 16 deletions(-)
-
-diff --git a/tests/023.phpt b/tests/023.phpt
-index 442fe3d..c1c72c3 100644
---- a/tests/023.phpt
-+++ b/tests/023.phpt
-@@ -19,24 +19,10 @@ function test($type, $variable, $test) {
- echo $test || $unserialized === null ? 'OK' : 'FAIL', PHP_EOL;
- }
-
--if (function_exists('curl_init')) {
-- $test = 'curl';
-- $res = curl_init('http://php.net/');
--} else {
-- $test = 'dir';
-- $res = opendir('/tmp');
--}
--
-+$res = opendir('/tmp');
- test('resource', $res, false);
-+closedir($res);
-
--switch ($test) {
-- case 'curl':
-- curl_close($res);
-- break;
-- default:
-- closedir($res);
-- break;
--}
- ?>
- --EXPECT--
- resource
-From 80d82ac7b21b660501886c5b29ea1186e025de91 Mon Sep 17 00:00:00 2001
-From: Michael Wallner <mike@php.net>
-Date: Wed, 23 Sep 2020 09:53:29 +0200
-Subject: [PATCH] tests: PHP 8 somehow detects recursion earlier
-
----
- package.xml | 242 ++++++++++++++++++++++++------------------------
- tests/009.phpt | 7 +-
- tests/009a.phpt | 99 ++++++++++++++++++++
- tests/026.phpt | 7 +-
- tests/026a.phpt | 109 ++++++++++++++++++++++
- 5 files changed, 336 insertions(+), 128 deletions(-)
- create mode 100644 tests/009a.phpt
- create mode 100644 tests/026a.phpt
-
-diff --git a/tests/009.phpt b/tests/009.phpt
-index feed76f..b917e98 100644
---- a/tests/009.phpt
-+++ b/tests/009.phpt
-@@ -2,11 +2,10 @@
- Check for reference serialization
- --SKIPIF--
- <?php
--if ((version_compare(PHP_VERSION, '5.2.13') <= 0) ||
-- (version_compare(PHP_VERSION, '5.3.0') >= 0 &&
-- version_compare(PHP_VERSION, '5.3.2') <= 0)) {
-- echo "skip tests in PHP 5.2.14/5.3.3 or newer";
-+if (version_compare(PHP_VERSION, "8.0.0dev", ">=")) {
-+ die("skip PHP >= 8.0\n");
- }
-+?>
- --FILE--
- <?php
- if(!extension_loaded('msgpack')) {
-diff --git a/tests/009a.phpt b/tests/009a.phpt
-new file mode 100644
-index 0000000..a155604
---- /dev/null
-+++ b/tests/009a.phpt
-@@ -0,0 +1,99 @@
-+--TEST--
-+Check for reference serialization
-+--SKIPIF--
-+<?php
-+if (version_compare(PHP_VERSION, "8.0.0dev", "<")) {
-+ die("skip PHP < 8.0\n");
-+}
-+?>
-+--FILE--
-+<?php
-+if(!extension_loaded('msgpack')) {
-+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
-+}
-+
-+function test($type, $variable, $test) {
-+ $serialized = msgpack_serialize($variable);
-+ $unserialized = msgpack_unserialize($serialized);
-+
-+ echo $type, PHP_EOL;
-+ echo bin2hex($serialized), PHP_EOL;
-+ var_dump($unserialized);
-+ echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
-+}
-+
-+$a = array('foo');
-+
-+test('array($a, $a)', array($a, $a), false);
-+test('array(&$a, &$a)', array(&$a, &$a), false);
-+
-+$a = array(null);
-+$b = array(&$a);
-+$a[0] = &$b;
-+
-+test('cyclic', $a, true);
-+
-+var_dump($a);
-+var_dump(msgpack_unserialize(msgpack_serialize($a)));
-+
-+--EXPECT--
-+array($a, $a)
-+9291a3666f6f91a3666f6f
-+array(2) {
-+ [0]=>
-+ array(1) {
-+ [0]=>
-+ string(3) "foo"
-+ }
-+ [1]=>
-+ array(1) {
-+ [0]=>
-+ string(3) "foo"
-+ }
-+}
-+OK
-+array(&$a, &$a)
-+9282c00100a3666f6f82c0020002
-+array(2) {
-+ [0]=>
-+ &array(1) {
-+ [0]=>
-+ string(3) "foo"
-+ }
-+ [1]=>
-+ &array(1) {
-+ [0]=>
-+ string(3) "foo"
-+ }
-+}
-+OK
-+cyclic
-+9182c0010082c0010082c0020002
-+array(1) {
-+ [0]=>
-+ &array(1) {
-+ [0]=>
-+ array(1) {
-+ [0]=>
-+ *RECURSION*
-+ }
-+ }
-+}
-+OK
-+array(1) {
-+ [0]=>
-+ &array(1) {
-+ [0]=>
-+ *RECURSION*
-+ }
-+}
-+array(1) {
-+ [0]=>
-+ &array(1) {
-+ [0]=>
-+ array(1) {
-+ [0]=>
-+ *RECURSION*
-+ }
-+ }
-+}
-diff --git a/tests/026.phpt b/tests/026.phpt
-index d89654d..ba59a71 100644
---- a/tests/026.phpt
-+++ b/tests/026.phpt
-@@ -3,11 +3,10 @@ Cyclic array test
- --INI--
- --SKIPIF--
- <?php
--if ((version_compare(PHP_VERSION, '5.2.13') <= 0) ||
-- (version_compare(PHP_VERSION, '5.3.0') >= 0 &&
-- version_compare(PHP_VERSION, '5.3.2') <= 0)) {
-- echo "skip tests in PHP 5.2.14/5.3.3 or newer";
-+if (version_compare(PHP_VERSION, "8.0.0dev", ">=")) {
-+ die("skip PHP >= 8.0");
- }
-+?>
- --FILE--
- <?php
- if(!extension_loaded('msgpack')) {
-diff --git a/tests/026a.phpt b/tests/026a.phpt
-new file mode 100644
-index 0000000..8abc61a
---- /dev/null
-+++ b/tests/026a.phpt
-@@ -0,0 +1,109 @@
-+--TEST--
-+Cyclic array test
-+--INI--
-+--SKIPIF--
-+<?php
-+
-+if (version_compare(PHP_VERSION, "8.0.0dev", "<")) {
-+ die("skip PHP < 8.0");
-+}
-+?>
-+--FILE--
-+<?php
-+if(!extension_loaded('msgpack')) {
-+ dl('msgpack.' . PHP_SHLIB_SUFFIX);
-+}
-+
-+function test($type, $variable, $test) {
-+ $serialized = msgpack_serialize($variable);
-+ $unserialized = msgpack_unserialize($serialized);
-+
-+ echo $type, PHP_EOL;
-+ echo bin2hex($serialized), PHP_EOL;
-+ var_dump($unserialized);
-+ echo $test || $unserialized == $variable ? 'OK' : 'ERROR', PHP_EOL;
-+}
-+
-+$a = array(
-+ 'a' => array(
-+ 'b' => 'c',
-+ 'd' => 'e'
-+ ),
-+);
-+
-+$a['f'] = &$a;
-+
-+test('array', $a, true);
-+
-+$a = array("foo" => &$b);
-+$b = array(1, 2, $a);
-+var_dump($a);
-+var_dump($k = msgpack_unserialize(msgpack_serialize($a)));
-+
-+$k["foo"][1] = "b";
-+var_dump($k);
-+?>
-+--EXPECT--
-+array
-+82a16182a162a163a164a165a16683c001a16182a162a163a164a165a16682c0020003
-+array(2) {
-+ ["a"]=>
-+ array(2) {
-+ ["b"]=>
-+ string(1) "c"
-+ ["d"]=>
-+ string(1) "e"
-+ }
-+ ["f"]=>
-+ &array(2) {
-+ ["a"]=>
-+ array(2) {
-+ ["b"]=>
-+ string(1) "c"
-+ ["d"]=>
-+ string(1) "e"
-+ }
-+ ["f"]=>
-+ *RECURSION*
-+ }
-+}
-+OK
-+array(1) {
-+ ["foo"]=>
-+ &array(3) {
-+ [0]=>
-+ int(1)
-+ [1]=>
-+ int(2)
-+ [2]=>
-+ *RECURSION*
-+ }
-+}
-+array(1) {
-+ ["foo"]=>
-+ &array(3) {
-+ [0]=>
-+ int(1)
-+ [1]=>
-+ int(2)
-+ [2]=>
-+ array(1) {
-+ ["foo"]=>
-+ *RECURSION*
-+ }
-+ }
-+}
-+array(1) {
-+ ["foo"]=>
-+ &array(3) {
-+ [0]=>
-+ int(1)
-+ [1]=>
-+ string(1) "b"
-+ [2]=>
-+ array(1) {
-+ ["foo"]=>
-+ *RECURSION*
-+ }
-+ }
-+}
diff --git a/php-pecl-msgpack.spec b/php-pecl-msgpack.spec
index 7fd8f65..9a37a11 100644
--- a/php-pecl-msgpack.spec
+++ b/php-pecl-msgpack.spec
@@ -3,55 +3,53 @@
#
# Fedora spec file for php-pecl-msgpack
#
-# Copyright (c) 2012-2020 Remi Collet
-# License: CC-BY-SA
+# Copyright (c) 2012-2023 Remi Collet
+# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
-%if 0%{?scl:1}
-%global sub_prefix %{scl_prefix}
-%scl_package php-pecl-msgpack
-%endif
+%{?scl:%scl_package php-pecl-msgpack}
+
+# Defined in Fedora >= 37 and RHEL >= 10, in PHP >= 7.4 for remirepo
+%{!?__phpize: %global __phpize %{_bindir}/phpize}
+%{!?__ztsphpize: %global __ztsphpize %{_bindir}/zts-phpize}
+%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config}
+%{!?__ztsphpconfig:%global __ztsphpconfig %{_bindir}/zts-php-config}
%global gh_commit 943d27267fbf6da6b4d225f344f4731aec0c671b
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner msgpack
%global gh_project msgpack-php
-#global gh_date 20171026
%global pecl_name msgpack
%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%global ini_name 40-%{pecl_name}.ini
-%global upstream_version 2.1.1
-#global upstream_prever beta1
-#global upstream_lower beta1
+%global upstream_version 2.2.0
+#global upstream_prever RC2
+#global upstream_lower RC2
+%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever}
+%global _configure ../%{sources}/configure
-%if 0
-%global with_msgpack 1
-%else
-%global with_msgpack 0
-%endif
+# to use system library
+%bcond_with msgpack
+
+# to disable test suite
+%bcond_without tests
Summary: API for communicating with MessagePack serialization
-Name: %{?sub_prefix}php-pecl-msgpack
-License: BSD
+Name: %{?scl_prefix}php-pecl-msgpack
+License: BSD-3-Clause
Version: %{upstream_version}%{?upstream_lower:~%{upstream_lower}}
URL: https://pecl.php.net/package/msgpack
-%if 0%{?gh_date:1}
-Release: 0.6.%{gh_date}.%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz
-%else
-Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Source: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
-%endif
-
-Patch0: %{pecl_name}-php8.patch
+BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
-BuildRequires: %{?scl_prefix}php-devel >= 7
+BuildRequires: %{?scl_prefix}php-devel >= 7.0
BuildRequires: %{?scl_prefix}php-pear
-%if %{with_msgpack}
+%if %{with msgpack}
BuildRequires: msgpack-devel
%else
Provides: bundled(msgpack) = 3.2.0
@@ -65,10 +63,7 @@ Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
-%if "%{?scl_prefix}" != "%{?sub_prefix}"
-Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release}
-Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
-%endif
+
%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
# Other third party repo stuff
%if "%{php_version}" > "7.3"
@@ -77,15 +72,6 @@ Obsoletes: php73-pecl-%{pecl_name} <= %{version}
%if "%{php_version}" > "7.4"
Obsoletes: php74-pecl-%{pecl_name} <= %{version}
%endif
-%if "%{php_version}" > "8.0"
-Obsoletes: php80-pecl-%{pecl_name} <= %{version}
-%endif
-%endif
-
-%if 0%{?fedora} < 20 && 0%{?rhel} < 7
-# Filter shared private
-%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
-%{?filter_setup}
%endif
@@ -112,10 +98,6 @@ Summary: MessagePack developer files (header)
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{?scl_prefix}php-devel%{?_isa}
-%if "%{?scl_prefix}" != "%{?sub_prefix}"
-Provides: %{?scl_prefix}php-pecl-%{pecl_name}-devel = %{version}-%{release}
-Provides: %{?scl_prefix}php-pecl-%{pecl_name}-devel%{?_isa} = %{version}-%{release}
-%endif
%description devel
@@ -124,20 +106,11 @@ These are the files needed to compile programs using MessagePack serializer.
%prep
%setup -qc
-%if 0%{?gh_date:1}
-mv %{gh_project}-%{gh_commit} NTS
-mv NTS/package.xml .
-sed -e '/release/s/0.5.6/%{version}%{?gh_date:dev}/' -i package.xml
-%else
-mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS
-%endif
%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
-cd NTS
-%patch0 -p1 -b .up
-
-%if %{with_msgpack}
+cd %{sources}
+%if %{with msgpack}
# use system library
rm -rf msgpack
%endif
@@ -150,9 +123,10 @@ if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:-dev}
fi
cd ..
+mkdir NTS
%if %{with_zts}
# duplicate for ZTS build
-cp -pr NTS ZTS
+mkdir ZTS
%endif
# Drop in the bit of configuration
@@ -171,15 +145,16 @@ EOF
%build
%{?dtsenable}
-cd NTS
-%{_bindir}/phpize
-%configure --with-php-config=%{_bindir}/php-config
+cd %{sources}
+%{__phpize}
+
+cd ../NTS
+%configure --with-php-config=%{__phpconfig}
make %{?_smp_mflags}
%if %{with_zts}
cd ../ZTS
-%{_bindir}/zts-phpize
-%configure --with-php-config=%{_bindir}/zts-php-config
+%configure --with-php-config=%{__ztsphpconfig}
make %{?_smp_mflags}
%endif
@@ -201,7 +176,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
# Test & Documentation
-cd NTS
+cd %{sources}
for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
do [ -f tests/$i ] && install -Dpm 644 tests/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/tests/$i
[ -f $i ] && install -Dpm 644 $i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i
@@ -214,33 +189,44 @@ done
%check
# Erratic results, segfauilt and mark as XFAIL
rm */tests/034.phpt
+%ifarch aarch64
+# too slow
+rm */tests/035.phpt
+%endif
+
+%if "%{php_version}" > "7.4"
+OPT="-q --show-diff %{?_smp_mflags}"
+%else
+OPT="-q --show-diff"
+%endif
-cd NTS
+cd %{sources}
: Minimal load test for NTS extension
%{__php} --no-php-ini \
--define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
+%if %{with tests}
: Upstream test suite for NTS extension
TEST_PHP_EXECUTABLE=%{__php} \
-TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
-NO_INTERACTION=1 \
-REPORT_EXIT_STATUS=0 \
-%{__php} -n run-tests.php --show-diff
+TEST_PHP_ARGS="-n -d extension_dir=$PWD/../NTS/modules -d extension=%{pecl_name}.so" \
+REPORT_EXIT_STATUS=1 \
+%{__php} -n run-tests.php $OPT
+%endif
%if %{with_zts}
-cd ../ZTS
: Minimal load test for ZTS extension
%{__ztsphp} --no-php-ini \
--define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
+%if %{with tests}
: Upstream test suite for ZTS extension
TEST_PHP_EXECUTABLE=%{__ztsphp} \
-TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
-NO_INTERACTION=1 \
-REPORT_EXIT_STATUS=0 \
-%{__ztsphp} -n run-tests.php --show-diff
+TEST_PHP_ARGS="-n -d extension_dir=$PWD/../ZTS/modules -d extension=%{pecl_name}.so" \
+REPORT_EXIT_STATUS=1 \
+%{__ztsphp} -n run-tests.php $OPT
+%endif
%endif
@@ -265,7 +251,7 @@ fi
%files
-%{?_licensedir:%license NTS/LICENSE}
+%{?_licensedir:%license %{sources}/LICENSE}
%doc %{pecl_docdir}/%{pecl_name}
%{pecl_xmldir}/%{name}.xml
@@ -288,6 +274,39 @@ fi
%changelog
+* Fri Jun 2 2023 Remi Collet <remi@remirepo.net> - 2.2.0-1
+- update to 2.2.0
+- build out of sources tree
+- use parallel execution for test suite
+
+* Fri Oct 7 2022 Remi Collet <remi@remirepo.net> - 2.2.0~RC2-1
+- update to 2.2.0RC2
+
+* Fri Sep 9 2022 Remi Collet <remi@remirepo.net> - 2.2.0~RC1-8
+- ignore 8 failed tests with PHP 8.2
+
+* Thu Jul 28 2022 Remi Collet <remi@remirepo.net> - 2.2.0~RC1-7
+- skip one test on aarch64
+
+* Mon Sep 6 2021 Remi Collet <remi@remirepo.net> - 2.2.0~RC1-6
+- F35 build
+
+* Wed Sep 01 2021 Remi Collet <remi@remirepo.net> - 2.2.0~RC1-4
+- rebuild for 8.1.0RC1
+
+* Tue Aug 31 2021 Remi Collet <remi@remirepo.net> - 2.2.0~RC1-1
+- update to 2.2.0RC1
+
+* Thu Jun 10 2021 Remi Collet <remi@remirepo.net> - 2.1.2-3
+- add patch for test suite with PHP 8.1 from
+ https://github.com/msgpack/msgpack-php/pull/156
+
+* Wed Apr 28 2021 Remi Collet <remi@remirepo.net> - 2.1.2-2
+- F34 rebuild for https://github.com/remicollet/remirepo/issues/174
+
+* Sat Nov 28 2020 Remi Collet <remi@remirepo.net> - 2.1.2-1
+- update to 2.1.2
+
* Wed Sep 30 2020 Remi Collet <remi@remirepo.net> - 2.1.1-3
- rebuild for PHP 8.0.0RC1