From 119bd26f95528b96876ddd40dcaa83bc28b8ccdd Mon Sep 17 00:00:00 2001 From: Ioannis Soumelidis Date: Fri, 13 Apr 2018 11:23:11 +0300 Subject: [PATCH 1/4] php 7.1 --- classes/Sap.php | 4 ++-- php_sap.c | 4 ++-- tests/sap_005_sap_invoke_function_error.phpt | 4 ++-- tests/sap_SapFunction___invoke_error.phpt | 4 ++-- tests/sap_SapRfcReadTable_select_error.phpt | 8 ++++---- tests/sap_Sap___construct_error.phpt | 2 +- tests/sap_Sap_call_error.phpt | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/classes/Sap.php b/classes/Sap.php index c7c3779..cc262bc 100644 --- a/classes/Sap.php +++ b/classes/Sap.php @@ -26,7 +26,7 @@ public function __construct(array $logonParameters = null) * @throws InvalidArgumentException If empty array provided * @throws SapConnectionException For invalid logon parameters or other error occured */ - public function connect(array $logonParameters) + public function connect(array $logonParameters): void { } @@ -78,7 +78,7 @@ public function call(string $function, array $args = null, bool $rtrim = null): * * @return void */ - public function setFunctionClass(string $class) + public function setFunctionClass(string $class): void { } diff --git a/php_sap.c b/php_sap.c index 80216c0..f548dda 100644 --- a/php_sap.c +++ b/php_sap.c @@ -305,7 +305,7 @@ ZEND_END_ARG_INFO() PHP_METHOD(Sap, connect); -ZEND_BEGIN_ARG_INFO(SAP_ME_ARGS(Sap, connect), 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, connect), IS_VOID, NULL, 0) ZEND_ARG_ARRAY_INFO(0, logonParameters, 0) ZEND_END_ARG_INFO() @@ -317,7 +317,7 @@ ZEND_END_ARG_INFO() PHP_METHOD(Sap, setFunctionClass); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, setFunctionClass), IS_NULL, NULL, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, setFunctionClass), IS_VOID, NULL, 0) ZEND_ARG_TYPE_INFO(0, className, IS_STRING, 0) ZEND_END_ARG_INFO() diff --git a/tests/sap_005_sap_invoke_function_error.phpt b/tests/sap_005_sap_invoke_function_error.phpt index af51838..a6cbaba 100644 --- a/tests/sap_005_sap_invoke_function_error.phpt +++ b/tests/sap_005_sap_invoke_function_error.phpt @@ -37,5 +37,5 @@ catch (TypeError $e) { Argument 1 passed to sap_invoke_function() must be of the type string, array given Argument 2 passed to sap_invoke_function() must be of the type resource, array given Argument 2 passed to sap_invoke_function() must be a resource of type SAP Connection -Argument 3 passed to sap_invoke_function() must be of the type array, string given -Argument 4 passed to sap_invoke_function() must be of the type boolean, array given \ No newline at end of file +Argument 3 passed to sap_invoke_function() must be of the type array or null, string given +Argument 4 passed to sap_invoke_function() must be of the type boolean or null, array given \ No newline at end of file diff --git a/tests/sap_SapFunction___invoke_error.phpt b/tests/sap_SapFunction___invoke_error.phpt index 36c4702..a6e6f2e 100644 --- a/tests/sap_SapFunction___invoke_error.phpt +++ b/tests/sap_SapFunction___invoke_error.phpt @@ -23,6 +23,6 @@ catch (LogicException $e) { } ?> --EXPECT-- -Argument 1 passed to SapFunction::__invoke() must be of the type array, string given -Argument 2 passed to SapFunction::__invoke() must be of the type boolean, array given +Argument 1 passed to SapFunction::__invoke() must be of the type array or null, string given +Argument 2 passed to SapFunction::__invoke() must be of the type boolean or null, array given Function's description has not been fetched \ No newline at end of file diff --git a/tests/sap_SapRfcReadTable_select_error.phpt b/tests/sap_SapRfcReadTable_select_error.phpt index 8874764..3c22d5b 100644 --- a/tests/sap_SapRfcReadTable_select_error.phpt +++ b/tests/sap_SapRfcReadTable_select_error.phpt @@ -81,10 +81,10 @@ Argument 1 passed to SapRfcReadTable::select() must not be an empty string Field names must be strings (integer detected) Argument 2 passed to SapRfcReadTable::select() must be of the type string, array given Argument 2 passed to SapRfcReadTable::select() must not be an empty string -Argument 3 passed to SapRfcReadTable::select() must be of the type array, string given -Argument 4 passed to SapRfcReadTable::select() must be of the type integer, array given +Argument 3 passed to SapRfcReadTable::select() must be of the type array or null, string given +Argument 4 passed to SapRfcReadTable::select() must be of the type integer or null, array given Argument 4 passed to SapRfcReadTable::select() must not be negative (-1) -Argument 5 passed to SapRfcReadTable::select() must be of the type integer, array given +Argument 5 passed to SapRfcReadTable::select() must be of the type integer or null, array given Argument 5 passed to SapRfcReadTable::select() must not be negative (-3) -Argument 6 passed to SapRfcReadTable::select() must be of the type boolean, array given +Argument 6 passed to SapRfcReadTable::select() must be of the type boolean or null, array given There is no connection to a SAP R/3 system \ No newline at end of file diff --git a/tests/sap_Sap___construct_error.phpt b/tests/sap_Sap___construct_error.phpt index 9cf4326..180106b 100644 --- a/tests/sap_Sap___construct_error.phpt +++ b/tests/sap_Sap___construct_error.phpt @@ -9,4 +9,4 @@ catch (TypeError $e ) { } ?> --EXPECT-- -Argument 1 passed to Sap::__construct() must be of the type array, string given \ No newline at end of file +Argument 1 passed to Sap::__construct() must be of the type array or null, string given diff --git a/tests/sap_Sap_call_error.phpt b/tests/sap_Sap_call_error.phpt index ab368e9..197d989 100644 --- a/tests/sap_Sap_call_error.phpt +++ b/tests/sap_Sap_call_error.phpt @@ -30,6 +30,6 @@ catch (LogicException $e) { ?> --EXPECT-- Argument 1 passed to Sap::call() must be of the type string, array given -Argument 2 passed to Sap::call() must be of the type array, string given -Argument 3 passed to Sap::call() must be of the type boolean, array given +Argument 2 passed to Sap::call() must be of the type array or null, string given +Argument 3 passed to Sap::call() must be of the type boolean or null, array given There is no connection to a SAP R/3 system \ No newline at end of file From 80e00af6af694584c6d0d0e040e5fc7bfd8b8063 Mon Sep 17 00:00:00 2001 From: Ioannis Soumelidis Date: Fri, 13 Apr 2018 11:34:01 +0300 Subject: [PATCH 2/4] php 7.2 --- php_sap.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/php_sap.c b/php_sap.c index f548dda..970cce8 100644 --- a/php_sap.c +++ b/php_sap.c @@ -120,13 +120,13 @@ pthread_mutex_t rfc_sapuc_to_utf8_mutex; PHP_FUNCTION(sap_connect); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_FE_ARGS(sap_connect), IS_RESOURCE, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_FE_ARGS(sap_connect), IS_RESOURCE, 0) ZEND_ARG_ARRAY_INFO(0, logonParams, 0) ZEND_END_ARG_INFO() PHP_FUNCTION(sap_invoke_function); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_FE_ARGS(sap_invoke_function), IS_ARRAY, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_FE_ARGS(sap_invoke_function), IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, moduleName, IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, connection, IS_RESOURCE, 0) ZEND_ARG_ARRAY_INFO(0, imports, 1) @@ -224,55 +224,55 @@ PHP_SAP_API zend_class_entry * php_sap_get_exception_ce(void) PHP_METHOD(SapException, getMessageKey); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageKey), IS_STRING, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageKey), IS_STRING, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getMessageType); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageType), IS_STRING, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageType), IS_STRING, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getMessageId); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageId), IS_STRING, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageId), IS_STRING, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getMessageNumber); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageNumber), IS_LONG, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageNumber), IS_LONG, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getMessageVar1); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar1), IS_STRING, NULL, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar1), IS_STRING, 1) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getMessageVar2); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar2), IS_STRING, NULL, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar2), IS_STRING, 1) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getMessageVar3); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar3), IS_STRING, NULL, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar3), IS_STRING, 1) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getMessageVar4); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar4), IS_STRING, NULL, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getMessageVar4), IS_STRING, 1) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapException, getNwSdkFunction); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getNwSdkFunction), IS_STRING, NULL, 1) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapException, getNwSdkFunction), IS_STRING, 1) /* no arguments */ ZEND_END_ARG_INFO() @@ -305,25 +305,25 @@ ZEND_END_ARG_INFO() PHP_METHOD(Sap, connect); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, connect), IS_VOID, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, connect), IS_VOID, 0) ZEND_ARG_ARRAY_INFO(0, logonParameters, 0) ZEND_END_ARG_INFO() PHP_METHOD(Sap, getFunctionClass); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, getFunctionClass), IS_STRING, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, getFunctionClass), IS_STRING, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(Sap, setFunctionClass); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, setFunctionClass), IS_VOID, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, setFunctionClass), IS_VOID, 0) ZEND_ARG_TYPE_INFO(0, className, IS_STRING, 0) ZEND_END_ARG_INFO() PHP_METHOD(Sap, call); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, call), IS_ARRAY, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, call), IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0) ZEND_ARG_ARRAY_INFO(0, imports, 1) ZEND_ARG_TYPE_INFO(0, rtrim, _IS_BOOL, 1) @@ -331,7 +331,7 @@ ZEND_END_ARG_INFO() PHP_METHOD(Sap, fetchFunction); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(SAP_ME_ARGS(Sap, fetchFunction), 0, 1, IS_OBJECT, "SapFunction", 0) +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO(SAP_ME_ARGS(Sap, fetchFunction), "SapFunction", 0) ZEND_ARG_INFO(0, name) ZEND_ARG_TYPE_INFO(0, moduleClass, IS_STRING, 0) ZEND_ARG_ARRAY_INFO(0, ctor_args, 0) @@ -339,7 +339,7 @@ ZEND_END_ARG_INFO() PHP_METHOD(Sap, getAttributes); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, getAttributes), IS_ARRAY, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(Sap, getAttributes), IS_ARRAY, 0) /* no arguments */ ZEND_END_ARG_INFO() @@ -358,39 +358,39 @@ const zend_function_entry sap_fe_Sap[] = { PHP_METHOD(SapFunction, getName); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, getName), IS_STRING, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, getName), IS_STRING, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapFunction, setActive); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, setActive), _IS_BOOL, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, setActive), _IS_BOOL, 0) ZEND_ARG_INFO(0, param) ZEND_ARG_INFO(0, isActive) ZEND_END_ARG_INFO() PHP_METHOD(SapFunction, isActive); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, isActive), _IS_BOOL, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, isActive), _IS_BOOL, 0) ZEND_ARG_INFO(0, param) ZEND_END_ARG_INFO() PHP_METHOD(SapFunction, __invoke); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, __invoke), IS_ARRAY, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, __invoke), IS_ARRAY, 0) ZEND_ARG_ARRAY_INFO(0, imports, 1) ZEND_ARG_TYPE_INFO(0, rtrim, _IS_BOOL, 1) ZEND_END_ARG_INFO() PHP_METHOD(SapFunction, getParameters); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, getParameters), IS_ARRAY, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, getParameters), IS_ARRAY, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapFunction, getTypeName); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, getTypeName), IS_STRING, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapFunction, getTypeName), IS_STRING, 0) ZEND_ARG_TYPE_INFO(0, param, IS_STRING, 0) ZEND_END_ARG_INFO() @@ -410,13 +410,13 @@ const zend_function_entry sap_fe_SapFunction[] = { /* SapRfcReadTable */ PHP_METHOD(SapRfcReadTable, getName); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapRfcReadTable, getName), IS_STRING, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapRfcReadTable, getName), IS_STRING, 0) /* no arguments */ ZEND_END_ARG_INFO() PHP_METHOD(SapRfcReadTable, select); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapRfcReadTable, select), IS_ARRAY, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapRfcReadTable, select), IS_ARRAY, 0) ZEND_ARG_INFO(0, fields) ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0) ZEND_ARG_ARRAY_INFO(0, options, 1) @@ -427,7 +427,7 @@ ZEND_END_ARG_INFO() PHP_METHOD(SapRfcReadTable, describe); -ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapRfcReadTable, describe), IS_ARRAY, NULL, 0) +ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO(SAP_ME_ARGS(SapRfcReadTable, describe), IS_ARRAY, 0) ZEND_ARG_TYPE_INFO(0, table, IS_STRING, 0) ZEND_ARG_ARRAY_INFO(0, fields, 0) ZEND_END_ARG_INFO() From a06bb0849ee6c37adcf789f0f3f9a74748e77df6 Mon Sep 17 00:00:00 2001 From: Ioannis Soumelidis Date: Fri, 13 Apr 2018 11:34:41 +0300 Subject: [PATCH 3/4] alter ext version to 7.2.x --- php_sap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/php_sap.h b/php_sap.h index 948a819..11627fa 100644 --- a/php_sap.h +++ b/php_sap.h @@ -15,7 +15,7 @@ # define PHP_SAP_DEBUG 0 #endif -#define PHP_SAP_VERSION "7.1.x" +#define PHP_SAP_VERSION "7.2.x" #define PHP_SAP_CONNECTION_RES_NAME "SAP Connection" #ifdef PHP_WIN32 From 1c2a058548e3c15b59ebeeefc63fbfb4f8de9cb3 Mon Sep 17 00:00:00 2001 From: Ioannis Soumelidis Date: Fri, 13 Apr 2018 11:43:23 +0300 Subject: [PATCH 4/4] fix doc --- functions/sap_invoke_function.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/functions/sap_invoke_function.php b/functions/sap_invoke_function.php index d636150..f2e3549 100644 --- a/functions/sap_invoke_function.php +++ b/functions/sap_invoke_function.php @@ -10,8 +10,6 @@ * @return array export/changing/table parameters for this function * * @throws InvalidArgumentException if $connection is not a valid SAP Connection resource - * @throws LogicException if no connection available, or function's description has not been fetched - * through a Sap object * @throws SapException RFC raised exception or other error occured */ function sap_invoke_function(string $name, $connection, array $imports = null, bool $rtrim = null): array {} \ No newline at end of file