From c1ee665cac66f54893b42193f16b572503762653 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 18 Jan 2021 08:33:29 +0100
Subject: update to 0.5.1

---
 PHPINFO              |   4 +-
 REFLECTION           | 116 +++++++++++++++++++++++++--------------------------
 php-pecl-trader.spec |  47 ++++++++-------------
 trader-tests.patch   |  43 +++++++++++++++++++
 4 files changed, 120 insertions(+), 90 deletions(-)
 create mode 100644 trader-tests.patch

diff --git a/PHPINFO b/PHPINFO
index 86cee87..4acbd67 100644
--- a/PHPINFO
+++ b/PHPINFO
@@ -2,8 +2,8 @@
 trader
 
 Trader Technical Analysis Library Support => enabled
-Version => 0.5.0
-TA-Lib version => 0.4.0 (Jul  1 2018 18:47:12)
+Version => 0.5.1
+TA-Lib version => 0.4.0 (Jan 18 2021 00:00:00)
 
 Directive => Local Value => Master Value
 trader.real_precision => 3 => 3
diff --git a/REFLECTION b/REFLECTION
index 4c90e32..b9a76a1 100644
--- a/REFLECTION
+++ b/REFLECTION
@@ -1,4 +1,4 @@
-Extension [ <persistent> extension #156 trader version 0.5.0 ] {
+Extension [ <persistent> extension #119 trader version 0.5.1 ] {
 
   - INI {
     Entry [ trader.real_precision <ALL> ]
@@ -10,65 +10,65 @@ Extension [ <persistent> extension #156 trader version 0.5.0 ] {
   }
 
   - Constants [59] {
-    Constant [ integer TRADER_MA_TYPE_SMA ] { 0 }
-    Constant [ integer TRADER_MA_TYPE_EMA ] { 1 }
-    Constant [ integer TRADER_MA_TYPE_WMA ] { 2 }
-    Constant [ integer TRADER_MA_TYPE_DEMA ] { 3 }
-    Constant [ integer TRADER_MA_TYPE_TEMA ] { 4 }
-    Constant [ integer TRADER_MA_TYPE_TRIMA ] { 5 }
-    Constant [ integer TRADER_MA_TYPE_KAMA ] { 6 }
-    Constant [ integer TRADER_MA_TYPE_MAMA ] { 7 }
-    Constant [ integer TRADER_MA_TYPE_T3 ] { 8 }
-    Constant [ float TRADER_REAL_MIN ] { -3,0E+37 }
-    Constant [ float TRADER_REAL_MAX ] { 3,0E+37 }
+    Constant [ int TRADER_MA_TYPE_SMA ] { 0 }
+    Constant [ int TRADER_MA_TYPE_EMA ] { 1 }
+    Constant [ int TRADER_MA_TYPE_WMA ] { 2 }
+    Constant [ int TRADER_MA_TYPE_DEMA ] { 3 }
+    Constant [ int TRADER_MA_TYPE_TEMA ] { 4 }
+    Constant [ int TRADER_MA_TYPE_TRIMA ] { 5 }
+    Constant [ int TRADER_MA_TYPE_KAMA ] { 6 }
+    Constant [ int TRADER_MA_TYPE_MAMA ] { 7 }
+    Constant [ int TRADER_MA_TYPE_T3 ] { 8 }
+    Constant [ float TRADER_REAL_MIN ] { -3.0E+37 }
+    Constant [ float TRADER_REAL_MAX ] { 3.0E+37 }
     Constant [ float TRADER_INTEGER_MIN ] { -2147483647 }
     Constant [ float TRADER_INTEGER_MAX ] { 2147483647 }
-    Constant [ integer TRADER_FUNC_UNST_ADX ] { 0 }
-    Constant [ integer TRADER_FUNC_UNST_ADXR ] { 1 }
-    Constant [ integer TRADER_FUNC_UNST_ATR ] { 2 }
-    Constant [ integer TRADER_FUNC_UNST_CMO ] { 3 }
-    Constant [ integer TRADER_FUNC_UNST_DX ] { 4 }
-    Constant [ integer TRADER_FUNC_UNST_EMA ] { 5 }
-    Constant [ integer TRADER_FUNC_UNST_HT_DCPERIOD ] { 6 }
-    Constant [ integer TRADER_FUNC_UNST_HT_DCPHASE ] { 7 }
-    Constant [ integer TRADER_FUNC_UNST_HT_PHASOR ] { 8 }
-    Constant [ integer TRADER_FUNC_UNST_HT_SINE ] { 9 }
-    Constant [ integer TRADER_FUNC_UNST_HT_TRENDLINE ] { 10 }
-    Constant [ integer TRADER_FUNC_UNST_HT_TRENDMODE ] { 11 }
-    Constant [ integer TRADER_FUNC_UNST_KAMA ] { 12 }
-    Constant [ integer TRADER_FUNC_UNST_MAMA ] { 13 }
-    Constant [ integer TRADER_FUNC_UNST_MFI ] { 14 }
-    Constant [ integer TRADER_FUNC_UNST_MINUS_DI ] { 15 }
-    Constant [ integer TRADER_FUNC_UNST_MINUS_DM ] { 16 }
-    Constant [ integer TRADER_FUNC_UNST_NATR ] { 17 }
-    Constant [ integer TRADER_FUNC_UNST_PLUS_DI ] { 18 }
-    Constant [ integer TRADER_FUNC_UNST_PLUS_DM ] { 19 }
-    Constant [ integer TRADER_FUNC_UNST_RSI ] { 20 }
-    Constant [ integer TRADER_FUNC_UNST_STOCHRSI ] { 21 }
-    Constant [ integer TRADER_FUNC_UNST_T3 ] { 22 }
-    Constant [ integer TRADER_FUNC_UNST_ALL ] { 23 }
-    Constant [ integer TRADER_FUNC_UNST_NONE ] { -1 }
-    Constant [ integer TRADER_COMPATIBILITY_DEFAULT ] { 0 }
-    Constant [ integer TRADER_COMPATIBILITY_METASTOCK ] { 1 }
-    Constant [ integer TRADER_ERR_SUCCESS ] { 0 }
-    Constant [ integer TRADER_ERR_LIB_NOT_INITIALIZE ] { 1 }
-    Constant [ integer TRADER_ERR_BAD_PARAM ] { 2 }
-    Constant [ integer TRADER_ERR_ALLOC_ERR ] { 3 }
-    Constant [ integer TRADER_ERR_GROUP_NOT_FOUND ] { 4 }
-    Constant [ integer TRADER_ERR_FUNC_NOT_FOUND ] { 5 }
-    Constant [ integer TRADER_ERR_INVALID_HANDLE ] { 6 }
-    Constant [ integer TRADER_ERR_INVALID_PARAM_HOLDER ] { 7 }
-    Constant [ integer TRADER_ERR_INVALID_PARAM_HOLDER_TYPE ] { 8 }
-    Constant [ integer TRADER_ERR_INVALID_PARAM_FUNCTION ] { 9 }
-    Constant [ integer TRADER_ERR_INPUT_NOT_ALL_INITIALIZE ] { 10 }
-    Constant [ integer TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE ] { 11 }
-    Constant [ integer TRADER_ERR_OUT_OF_RANGE_START_INDEX ] { 12 }
-    Constant [ integer TRADER_ERR_OUT_OF_RANGE_END_INDEX ] { 13 }
-    Constant [ integer TRADER_ERR_INVALID_LIST_TYPE ] { 14 }
-    Constant [ integer TRADER_ERR_BAD_OBJECT ] { 15 }
-    Constant [ integer TRADER_ERR_NOT_SUPPORTED ] { 16 }
-    Constant [ integer TRADER_ERR_INTERNAL_ERROR ] { 5000 }
-    Constant [ integer TRADER_ERR_UNKNOWN_ERROR ] { 65535 }
+    Constant [ int TRADER_FUNC_UNST_ADX ] { 0 }
+    Constant [ int TRADER_FUNC_UNST_ADXR ] { 1 }
+    Constant [ int TRADER_FUNC_UNST_ATR ] { 2 }
+    Constant [ int TRADER_FUNC_UNST_CMO ] { 3 }
+    Constant [ int TRADER_FUNC_UNST_DX ] { 4 }
+    Constant [ int TRADER_FUNC_UNST_EMA ] { 5 }
+    Constant [ int TRADER_FUNC_UNST_HT_DCPERIOD ] { 6 }
+    Constant [ int TRADER_FUNC_UNST_HT_DCPHASE ] { 7 }
+    Constant [ int TRADER_FUNC_UNST_HT_PHASOR ] { 8 }
+    Constant [ int TRADER_FUNC_UNST_HT_SINE ] { 9 }
+    Constant [ int TRADER_FUNC_UNST_HT_TRENDLINE ] { 10 }
+    Constant [ int TRADER_FUNC_UNST_HT_TRENDMODE ] { 11 }
+    Constant [ int TRADER_FUNC_UNST_KAMA ] { 12 }
+    Constant [ int TRADER_FUNC_UNST_MAMA ] { 13 }
+    Constant [ int TRADER_FUNC_UNST_MFI ] { 14 }
+    Constant [ int TRADER_FUNC_UNST_MINUS_DI ] { 15 }
+    Constant [ int TRADER_FUNC_UNST_MINUS_DM ] { 16 }
+    Constant [ int TRADER_FUNC_UNST_NATR ] { 17 }
+    Constant [ int TRADER_FUNC_UNST_PLUS_DI ] { 18 }
+    Constant [ int TRADER_FUNC_UNST_PLUS_DM ] { 19 }
+    Constant [ int TRADER_FUNC_UNST_RSI ] { 20 }
+    Constant [ int TRADER_FUNC_UNST_STOCHRSI ] { 21 }
+    Constant [ int TRADER_FUNC_UNST_T3 ] { 22 }
+    Constant [ int TRADER_FUNC_UNST_ALL ] { 23 }
+    Constant [ int TRADER_FUNC_UNST_NONE ] { -1 }
+    Constant [ int TRADER_COMPATIBILITY_DEFAULT ] { 0 }
+    Constant [ int TRADER_COMPATIBILITY_METASTOCK ] { 1 }
+    Constant [ int TRADER_ERR_SUCCESS ] { 0 }
+    Constant [ int TRADER_ERR_LIB_NOT_INITIALIZE ] { 1 }
+    Constant [ int TRADER_ERR_BAD_PARAM ] { 2 }
+    Constant [ int TRADER_ERR_ALLOC_ERR ] { 3 }
+    Constant [ int TRADER_ERR_GROUP_NOT_FOUND ] { 4 }
+    Constant [ int TRADER_ERR_FUNC_NOT_FOUND ] { 5 }
+    Constant [ int TRADER_ERR_INVALID_HANDLE ] { 6 }
+    Constant [ int TRADER_ERR_INVALID_PARAM_HOLDER ] { 7 }
+    Constant [ int TRADER_ERR_INVALID_PARAM_HOLDER_TYPE ] { 8 }
+    Constant [ int TRADER_ERR_INVALID_PARAM_FUNCTION ] { 9 }
+    Constant [ int TRADER_ERR_INPUT_NOT_ALL_INITIALIZE ] { 10 }
+    Constant [ int TRADER_ERR_OUTPUT_NOT_ALL_INITIALIZE ] { 11 }
+    Constant [ int TRADER_ERR_OUT_OF_RANGE_START_INDEX ] { 12 }
+    Constant [ int TRADER_ERR_OUT_OF_RANGE_END_INDEX ] { 13 }
+    Constant [ int TRADER_ERR_INVALID_LIST_TYPE ] { 14 }
+    Constant [ int TRADER_ERR_BAD_OBJECT ] { 15 }
+    Constant [ int TRADER_ERR_NOT_SUPPORTED ] { 16 }
+    Constant [ int TRADER_ERR_INTERNAL_ERROR ] { 5000 }
+    Constant [ int TRADER_ERR_UNKNOWN_ERROR ] { 65535 }
   }
 
   - Functions {
diff --git a/php-pecl-trader.spec b/php-pecl-trader.spec
index 6b2a758..4c3081d 100644
--- a/php-pecl-trader.spec
+++ b/php-pecl-trader.spec
@@ -1,6 +1,6 @@
 # spec file for php-pecl-trader
 #
-# Copyright (c) 2015-2019 Remi Collet
+# Copyright (c) 2015-2021 Remi Collet
 # License: CC-BY-SA
 # http://creativecommons.org/licenses/by-sa/4.0/
 #
@@ -28,15 +28,18 @@
 
 Summary:        Technical Analysis for traders
 Name:           %{?sub_prefix}php-pecl-%{pecl_name}
-Version:        0.5.0
-Release:        5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Version:        0.5.1
+Release:        1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
 # PHP ext is BSD-2, ta-lib is BSD-3
 License:        BSD
-URL:            http://pecl.php.net/package/%{pecl_name}
-Source0:        http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+URL:            https://pecl.php.net/package/%{pecl_name}
+Source0:        https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
 
+Patch0:         %{pecl_name}-tests.patch
+
+BuildRequires:  make
 BuildRequires:  %{?dtsprefix}gcc
-BuildRequires:  %{?scl_prefix}php-devel
+BuildRequires:  %{?scl_prefix}php-devel >= 7.0
 BuildRequires:  %{?scl_prefix}php-pear
 
 Requires:       %{?scl_prefix}php(zend-abi) = %{php_zend_api}
@@ -51,38 +54,17 @@ Provides:       %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
 Provides:       %{?scl_prefix}php-pecl-%{pecl_name}          = %{version}-%{release}
 Provides:       %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa}  = %{version}-%{release}
 
-%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
 # Other third party repo stuff
-%if "%{php_version}" > "5.6"
-Obsoletes:     php56u-pecl-%{pecl_name} <= %{version}
-Obsoletes:     php56w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.0"
-Obsoletes:     php70u-pecl-%{pecl_name} <= %{version}
-Obsoletes:     php70w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.1"
-Obsoletes:     php71u-pecl-%{pecl_name} <= %{version}
-Obsoletes:     php71w-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.2"
-Obsoletes:     php72u-pecl-%{pecl_name} <= %{version}
-Obsoletes:     php72w-pecl-%{pecl_name} <= %{version}
-%endif
 %if "%{php_version}" > "7.3"
 Obsoletes:      php73-pecl-%{pecl_name} <= %{version}
-Obsoletes:     php73w-pecl-%{pecl_name} <= %{version}
 %endif
 %if "%{php_version}" > "7.4"
 Obsoletes:      php74-pecl-%{pecl_name} <= %{version}
-Obsoletes:     php74w-pecl-%{pecl_name} <= %{version}
 %endif
+%if "%{php_version}" > "8.0"
+Obsoletes:      php80-pecl-%{pecl_name} <= %{version}
 %endif
-
-%if 0%{?fedora} < 20 && 0%{?rhel} < 7
-# Filter shared private
-%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
-%{?filter_setup}
 %endif
 
 
@@ -107,6 +89,8 @@ sed -e 's/role="test"/role="src"/' \
     -i package.xml
 
 cd NTS
+%patch0 -p3
+
 # Sanity check, really often broken
 extver=$(sed -n '/#define PHP_TRADER_VERSION/{s/.* "//;s/".*$//;p}' php_trader.h)
 if test "x${extver}" != "x%{version}"; then
@@ -239,6 +223,9 @@ REPORT_EXIT_STATUS=1 \
 
 
 %changelog
+* Mon Jan 18 2021 Remi Collet <remi@remirepo.net> - 0.5.1-1
+- update to 0.5.1
+
 * Tue Sep 03 2019 Remi Collet <remi@remirepo.net> - 0.5.0-5
 - rebuild for 7.4.0RC1
 
diff --git a/trader-tests.patch b/trader-tests.patch
new file mode 100644
index 0000000..c774f13
--- /dev/null
+++ b/trader-tests.patch
@@ -0,0 +1,43 @@
+--- pecl/trader/trunk/tests/trader_bbands_01.phpt	2021/01/17 21:07:36	352308
++++ pecl/trader/trunk/tests/trader_bbands_01.phpt	2021/01/18 07:21:15	352309
+@@ -3,6 +3,8 @@
+ --SKIPIF--
+ <?php
+ if (!extension_loaded("trader")) die("skip");
++if (PHP_VERSION_ID >= 80000) die ("skip PHP 7 only");
++?>
+ --INI--
+ trader.real_precision=3
+ --FILE--
+@@ -1464,4 +1466,4 @@
+     [251]=>
+     float(2.6519196935811E+37)
+   }
+-}
+\ No newline at end of file
++}
+--- pecl/trader/trunk/tests/trader_ini_01.phpt	2021/01/17 21:07:36	352308
++++ pecl/trader/trunk/tests/trader_ini_01.phpt	2021/01/18 07:21:15	352309
+@@ -35,7 +35,12 @@
+ ini_set('trader.real_round_mode', 'schnitzel');
+ var_dump(ini_get('trader.real_round_mode'));
+ 
+-ini_set('trader.real_round_mode', array());
++try {
++	// Hide warning for PHP 7
++	@ini_set('trader.real_round_mode', array());
++} catch (TypeError $e) {
++	// Hide exception for PHP 8
++}
+ var_dump(ini_get('trader.real_round_mode'));
+ 
+ ini_set('trader.real_round_mode', 42);
+@@ -55,8 +60,6 @@
+ 
+ Warning: ini_set(): Invalid value 'schnitzel' for trader.real_round_mode in %strader_ini_01.php on line %d
+ string(8) "half_odd"
+-
+-Warning: ini_set() expects parameter 2 to be string, array given in %strader_ini_01.php on line %d
+ string(8) "half_odd"
+ 
+ Warning: ini_set(): Invalid value '42' for trader.real_round_mode in %strader_ini_01.php on line %d
-- 
cgit