diff --git a/docs/usage.rst b/docs/usage.rst index 64fdedf..db70a2d 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -177,7 +177,7 @@ be passed specifying options for the function call. // ... $options = [ - 'rtrim' => false + 'rtrim' => true ]; $function->invoke($parameters, $options); @@ -191,7 +191,7 @@ rtrim ``rtrim`` option is available. If set to ``true``, type C strings are right-trimmed before being returned. - *Default:* ``true`` + *Default:* ``false`` Activating/Deactivating parameters ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/sapnwrfc.c b/sapnwrfc.c index 96f43a2..7a46bb1 100644 --- a/sapnwrfc.c +++ b/sapnwrfc.c @@ -682,7 +682,7 @@ PHP_METHOD(RemoteFunction, invoke) zval *val; zval retval; SAP_UC *parameter_name_u; - unsigned char rtrim_enabled = 1; + unsigned char rtrim_enabled = 0; zend_replace_error_handling(EH_THROW, sapnwrfc_function_exception_ce, NULL); diff --git a/tests/041_invoke_returns_result.phpt b/tests/041_invoke_returns_result.phpt index 6fe777a..41f78d3 100644 --- a/tests/041_invoke_returns_result.phpt +++ b/tests/041_invoke_returns_result.phpt @@ -44,8 +44,8 @@ var_dump($result["ECHOSTRUCT"]["RFCFLOAT"] == $importStruct["RFCFLOAT"]); var_dump($result["ECHOSTRUCT"]["RFCINT1"] == $importStruct["RFCINT1"]); var_dump($result["ECHOSTRUCT"]["RFCINT2"] == $importStruct["RFCINT2"]); var_dump($result["ECHOSTRUCT"]["RFCINT4"] == $importStruct["RFCINT4"]); -var_dump($result["ECHOSTRUCT"]["RFCDATA1"] == $importStruct["RFCDATA1"]); -var_dump($result["ECHOSTRUCT"]["RFCDATA2"] == $importStruct["RFCDATA2"]); +var_dump($result["ECHOSTRUCT"]["RFCDATA1"] == str_pad($importStruct["RFCDATA1"], 50, ' ', STR_PAD_RIGHT)); +var_dump($result["ECHOSTRUCT"]["RFCDATA2"] == str_pad($importStruct["RFCDATA2"], 50, ' ', STR_PAD_RIGHT)); var_dump(count($result["RFCTABLE"]) == 2); var_dump($result["RFCTABLE"][1]["RFCFLOAT"] == $importStruct["RFCFLOAT"] + 1); diff --git a/tests/084_rtrim_enabled_by_default.phpt b/tests/084_rtrim_disabled_by_default.phpt similarity index 77% rename from tests/084_rtrim_enabled_by_default.phpt rename to tests/084_rtrim_disabled_by_default.phpt index aeda000..af3e112 100644 --- a/tests/084_rtrim_enabled_by_default.phpt +++ b/tests/084_rtrim_disabled_by_default.phpt @@ -1,5 +1,5 @@ --TEST-- -rtrim is enabled by default. +rtrim is disabled by default. --SKIPIF-- --FILE-- @@ -28,8 +28,8 @@ $f = $c->getFunction("STFC_STRUCTURE"); $f->setParameterActive('RFCTABLE', false); $ret = $f->invoke($params); -var_dump($ret['ECHOSTRUCT']['RFCDATA1'] == '1DATA1'); -var_dump($ret['ECHOSTRUCT']['RFCDATA2'] == 'DATA222'); +var_dump($ret['ECHOSTRUCT']['RFCDATA1'] == str_pad('1DATA1', 50, ' ', STR_PAD_RIGHT)); +var_dump($ret['ECHOSTRUCT']['RFCDATA2'] == str_pad('DATA222', 50, ' ', STR_PAD_RIGHT)); --EXPECT-- bool(true) diff --git a/tests/085_returned_CHAR_is_not_right_trimmed_when_rtrim_option_disabled.phpt b/tests/085_returned_CHAR_is_not_right_trimmed_when_rtrim_option_disabled.phpt index 801f721..24c1cd2 100644 --- a/tests/085_returned_CHAR_is_not_right_trimmed_when_rtrim_option_disabled.phpt +++ b/tests/085_returned_CHAR_is_not_right_trimmed_when_rtrim_option_disabled.phpt @@ -1,5 +1,5 @@ --TEST-- -Returned CHAR value is not right-trimmed when rtrim option disabled. +Returned CHAR value is right-trimmed when rtrim option enabled. --SKIPIF-- --FILE-- @@ -27,10 +27,10 @@ $params = [ $f = $c->getFunction("STFC_STRUCTURE"); $f->setParameterActive('RFCTABLE', false); -$ret = $f->invoke($params, ['rtrim' => false]); +$ret = $f->invoke($params, ['rtrim' => true]); -var_dump($ret['ECHOSTRUCT']['RFCDATA1'] == str_pad('1DATA1', 50, ' ', STR_PAD_RIGHT)); -var_dump($ret['ECHOSTRUCT']['RFCDATA2'] == str_pad('DATA222', 50, ' ', STR_PAD_RIGHT)); +var_dump($ret['ECHOSTRUCT']['RFCDATA1'] == '1DATA1'); +var_dump($ret['ECHOSTRUCT']['RFCDATA2'] == 'DATA222'); --EXPECT-- bool(true)