Comments (7)
This is the returned valued from SAP (i guess). That was also the behaviour in the PHP5 extension.
If i'm not wrong, SAP always fill the fields with whitespaces to the defined length of the column.
from php7-sapnwrfc.
@ThaDafinser I also think you are right.
@studio2222 Think of the following scenario, you receive a GUID from SAP result that is always 16 bytes long. After applying a recursive trim over all the array (I always did this to remove unused spaces) sometimes the last character of a GUID is a space, end of line or carriage return (happens) and you mess up the data. I lost many hours trying to figure out where I was wrong and it was the trimming.
from php7-sapnwrfc.
Yeah these 90/10 scenarios are tough. Previously we were using the saprfc connector which auto trimmed, and we detected this difference when comparing old version new results. However since it seems that 90% of the time trimming the values is more helpful and harmful, would you be ok adding a configuration setting that would turn trimming on? Say as part of the call function method or as maybe a global setting you can turn on/off?
from php7-sapnwrfc.
👎 for a configuration - this could lead to accidental errors like told by @avadaneidanut
Better an extra function, which does this job
from php7-sapnwrfc.
I'll look into this after my holiday...
from php7-sapnwrfc.
Back from holiday...
Initially, I planned to provide an option to automatically trim returned values. But the more I think about it, the less I think this would be good or the right way.
The developer should know what kind of values/data types to expect to be returned from SAP and therefore should decide whether to trim or not on a per item base. Letting the extension do the trimming just hides the fact that SAP has different data types, padding, etc. - and in my experience, such magic causes bugs.
Also, I would not be sure where to add an option for auto-trimming:
- Setting a global option does not feel right, as it might not be obvious which setting is effective at the time of calling an RFC.
- Adding a parameter to
invoke()
might work, though.
Using 2) might work, up until the time where you have RFCs that return complex and/or nested structures/tables where you would want one member to be trimmed, but not the other. So you end up doing the trimming manually anyways.
Personally, I use trim()
manually on every item that I want to be trimmed. That way, I make the decision an explicit one and I always know the data I am handling.
from php7-sapnwrfc.
Ok, agreed. Not the end of the world. I've added code to trim all values coming back.
from php7-sapnwrfc.
Related Issues (20)
- php_sapnwrfc.dll under PHP 8.1.11 HOT 7
- php_sapnwrfc-2.0.0-beta2-8.1.0-vs16-ts-x64.dll Unable to load dynamic library HOT 6
- PHP 7.3.2 + SAP NW RFC 7.50 Unable to add sapnwrfc Extension
- Unable to add extenstion PHP7 SAP NW RFC HOT 1
- Where tofind SYSNR
- Scripts works only executed on CLI HOT 1
- Solution: Docker with build for PHP 8.2
- SAP NWRFC is not a valid win32 version HOT 1
- Error during Make HOT 7
- Can't do two calls HOT 2
- Warning Library HOT 2
- PHP Fatal error: Possible integer overflow in memory allocation (1610760192 32 + 32) HOT 2
- Pre-build for 8.2.4 HOT 1
- Extension got disappeared after somedays HOT 1
- PHP Startup: Unable to load dynamic library php_sapnwrfc.dll HOT 3
- PHP 7.2 + SAP NW RFC 7.20 +php7-sapnwrfc 1.3.0 return parameter is empty HOT 2
- Memory Leak Issue in SAP PHP Connection: Seeking Advice on Workaround HOT 15
- Error building PHP Version: 8.3.3 with sap nw rfc 7.5 patch 12 HOT 2
- Update Windows build instructions HOT 1
- please release php_sapnwrfc.dll for PHP 8.3.8 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php7-sapnwrfc.