summaryrefslogtreecommitdiffstats
path: root/5.patch
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-08-25 09:58:58 +0200
committerRemi Collet <remi@remirepo.net>2021-08-25 09:58:58 +0200
commited43300dab14e50d2925dc78a9eb5fc5f2e9ae98 (patch)
tree24e77b1776a7f8afb9e46072b70e09799c1fddcf /5.patch
initial package, version 1.0.0 (stable)
open https://github.com/SeasX/SeasSnowflake/pull/3 - fix test open https://github.com/SeasX/SeasSnowflake/pull/4 - exec perm open https://github.com/SeasX/SeasSnowflake/pull/5 - PHP 5 open https://github.com/SeasX/SeasSnowflake/pull/6 - arginfo
Diffstat (limited to '5.patch')
-rw-r--r--5.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/5.patch b/5.patch
new file mode 100644
index 0000000..35f8676
--- /dev/null
+++ b/5.patch
@@ -0,0 +1,66 @@
+From a0a028b2987b030153e21510ffd90a8eaf17b0ba Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 25 Aug 2021 09:28:36 +0200
+Subject: [PATCH 1/2] fix for PHP 5
+
+---
+ SeasSnowflake.cpp | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/SeasSnowflake.cpp b/SeasSnowflake.cpp
+index 1a3282e..06b3f5f 100755
+--- a/SeasSnowflake.cpp
++++ b/SeasSnowflake.cpp
+@@ -270,7 +270,11 @@ PHP_METHOD(SEASSNOWFLAKE_RES_NAME, generate)
+ PHP_METHOD(SEASSNOWFLAKE_RES_NAME, degenerate)
+ {
+ char *id = NULL;
++#if PHP_VERSION_ID < 70000
++ int l_id = 0;
++#else
+ size_t l_id = 0;
++#endif
+ // zval* params = NULL;
+
+ auto &idWorker = Singleton<IdWorker>::instance();
+@@ -284,7 +288,7 @@ PHP_METHOD(SEASSNOWFLAKE_RES_NAME, degenerate)
+ idWorker.setWorkerId(Z_LVAL_P(datacenter_id));
+
+ #ifndef FAST_ZPP
+- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|z", &id, &l_id, &params) == FAILURE)
++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &id, &l_id) == FAILURE)
+ {
+ return;
+ }
+
+From bfe79ed7abdfb65a0b1ab9b12723f1b717d63306 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 25 Aug 2021 09:46:34 +0200
+Subject: [PATCH 2/2] fix for 5.4 (lvalue required)
+
+---
+ SeasSnowflake.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/SeasSnowflake.cpp b/SeasSnowflake.cpp
+index 06b3f5f..be2b846 100755
+--- a/SeasSnowflake.cpp
++++ b/SeasSnowflake.cpp
+@@ -313,7 +313,7 @@ PHP_METHOD(SEASSNOWFLAKE_RES_NAME, degenerate)
+ uint dataCenterId=idWorker.degenerateDataCenterId(id_i);
+ uint64_t beginTimestamp=idWorker.degenerateBeginTimestamp(id_i);
+ uint64_t timestamp= idWorker.degenerateTimestamp(id_i);
+- zval arr;
++ zval arr, *parr = &arr;
+
+ array_init(&arr);
+ add_assoc_long_ex(&arr, "worker_id", strlen("worker_id"), workerId);
+@@ -323,7 +323,7 @@ PHP_METHOD(SEASSNOWFLAKE_RES_NAME, degenerate)
+ add_assoc_long_ex(&arr, "begin_timestamp", strlen("begin_timestamp"), beginTimestamp);
+ add_assoc_long_ex(&arr, "interval", strlen("interval"), interval);
+
+- RETURN_ZVAL(&arr, 0, 1);
++ RETURN_ZVAL(parr, 0, 1);
+ } catch (const std::exception& e){
+ #if PHP_VERSION_ID < 80000
+ sc_zend_throw_exception(NULL, e.what(), 0 TSRMLS_CC);