Skip to content

Commit

Permalink
disable rtrim option by default
Browse files Browse the repository at this point in the history
this fixes a BC break introduced in bfe868c.

refs #49
  • Loading branch information
gkralik committed Mar 8, 2018
1 parent 2be2846 commit 4bcc3ed
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ be passed specifying options for the function call.
// ...
$options = [
'rtrim' => false
'rtrim' => true
];
$function->invoke($parameters, $options);
Expand All @@ -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
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion sapnwrfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions tests/041_invoke_returns_result.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--TEST--
rtrim is enabled by default.
rtrim is disabled by default.
--SKIPIF--
<?php include("should_run_online_tests.inc"); ?>
--FILE--
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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--
<?php include("should_run_online_tests.inc"); ?>
--FILE--
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 4bcc3ed

Please sign in to comment.