summaryrefslogtreecommitdiffstats
path: root/6.patch
blob: 3b0c26f59c3e7b46d5a5dee9e2c63ec370c99826 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
From b5df08afb79b6fa8071420ec096a0c75d02d682e Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 25 Aug 2021 09:34:34 +0200
Subject: [PATCH 1/2] generate have no arg

---
 SeasSnowflake.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/SeasSnowflake.cpp b/SeasSnowflake.cpp
index 1a3282e..ccc04a1 100755
--- a/SeasSnowflake.cpp
+++ b/SeasSnowflake.cpp
@@ -59,8 +59,7 @@ ZEND_BEGIN_ARG_INFO_EX(SeasSnowflake_construct, 0, 0, 1)
 ZEND_ARG_INFO(0, parames)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO_EX(SeasSnowflake_generate, 0, 0, 1)
-ZEND_ARG_INFO(0, id)
+ZEND_BEGIN_ARG_INFO_EX(SeasSnowflake_generate, 0, 0, 0)
 ZEND_END_ARG_INFO()
 
 ZEND_BEGIN_ARG_INFO_EX(SeasSnowflake_degenerate, 0, 0, 1)
@@ -244,6 +243,10 @@ PHP_METHOD(SEASSNOWFLAKE_RES_NAME, generate)
     zval *worker_id = sc_zend_read_property(SeasSnowflake_ce, this_obj, "worker_id", sizeof("worker_id") - 1, 0);
     zval *datacenter_id = sc_zend_read_property(SeasSnowflake_ce, this_obj, "datacenter_id", sizeof("datacenter_id") - 1, 0);
 
+    if (zend_parse_parameters_none() == FAILURE)
+    {
+        return;
+    }
 
     idWorker.setDatacenterId(Z_LVAL_P(worker_id));
     idWorker.setWorkerId(Z_LVAL_P(datacenter_id));

From a0b25161727f7346f8120f9e0161e498451e0b0e Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 25 Aug 2021 09:37:39 +0200
Subject: [PATCH 2/2] degenerate have a single arg

---
 SeasSnowflake.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SeasSnowflake.cpp b/SeasSnowflake.cpp
index ccc04a1..c36197b 100755
--- a/SeasSnowflake.cpp
+++ b/SeasSnowflake.cpp
@@ -294,7 +294,7 @@ PHP_METHOD(SEASSNOWFLAKE_RES_NAME, degenerate)
     #else
     #undef IS_UNDEF
     #define IS_UNDEF Z_EXPECTED_LONG
-        ZEND_PARSE_PARAMETERS_START(1, 2)
+        ZEND_PARSE_PARAMETERS_START(1, 1)
         Z_PARAM_STRING(id, l_id)
         Z_PARAM_OPTIONAL
     //  Z_PARAM_ARRAY(params)