Menu

#373 The 'substr()' function is defined wrong

v1.1.x
fixed
None
v1.1.0
Bug Fix
2018-11-16
2018-08-31
Erik Hänel
No

The string function substr() is defined wrong. It is not possible to extract a string with length zero, instead the zero is converted into the length of the string.

Analysis:

This is a simple fix. In the string function for substr() (function name static string strfnc_substr()), one has to add a case for the string length zero (funcArgs.nArg2), which will return the value "\"\"" instead of the already existing solution.

Implementation:

  • Implementation: Changed as proposed by the analysis
  • Revision: [r416]
  • Implementation test: Substring with zero length was created

Documentation:

  • ChangesLog: updated
  • Comments: not needed
  • Documentation articles: not needed
  • Language files: not needed

Tests:

This fix was added to the automatic SW tests. No deviations detected.

Related

Commit: [r416]

Discussion

  • Erik Hänel

    Erik Hänel - 2018-08-31
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2018-08-31
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,18 @@
     The string function `substr()` is defined wrong. It is not possible to extract a string with length zero, instead the zero is converted into the length of the string.
    +
    +###Analysis:
    +(*Describe, what's the issue and which changes have to be made*)
    +
    +###Implementation:
    +* Implementation: (*Describe, what you've changed*) 
    +* Revision: [rXXX]
    +* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +
    +###Documentation:
    +* ChangesLog: (*Have you updated the changes log?*)
    +* Comments: (*Have you written comments in the code, which describe your change?*)
    +* Documentation articles: (*Have you updated the documentation articles?*)
    +* Language files: (*Have you updated the language files?*)
    +
    +###Tests:
    +(*Describe, which tests you performed and their outcome*)
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2018-08-31
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,7 +1,7 @@
     The string function `substr()` is defined wrong. It is not possible to extract a string with length zero, instead the zero is converted into the length of the string.
    
     ###Analysis:
    -(*Describe, what's the issue and which changes have to be made*)
    +This is a simple fix. In the string function for `substr()` (function name `static string strfnc_substr()`), one has to add a case for the string length zero (`funcArgs.nArg2`), which will return the value `"\"\""` instead of the already existing solution.
    
     ###Implementation:
    
     * Implementation: (*Describe, what you've changed*) 
    
    • status: analyzing --> implementing
    • assigned_to: Erik Hänel --> Jonas Jansen
     
  • Erik Hänel

    Erik Hänel - 2018-11-14
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,15 +4,15 @@
     This is a simple fix. In the string function for `substr()` (function name `static string strfnc_substr()`), one has to add a case for the string length zero (`funcArgs.nArg2`), which will return the value `"\"\""` instead of the already existing solution.
    
     ###Implementation:
    -* Implementation: (*Describe, what you've changed*) 
    -* Revision: [rXXX]
    -* Implementation test: (*Describe the type of test, which you performed, and if it was successful*)
    +* Implementation: Changed as proposed by the analysis
    +* Revision: [r416]
    +* Implementation test: Substring with zero length was created
    
     ###Documentation:
    -* ChangesLog: (*Have you updated the changes log?*)
    -* Comments: (*Have you written comments in the code, which describe your change?*)
    -* Documentation articles: (*Have you updated the documentation articles?*)
    -* Language files: (*Have you updated the language files?*)
    +* ChangesLog: updated
    +* Comments: not needed
    +* Documentation articles: not needed
    +* Language files: not needed
    
     ###Tests:
     (*Describe, which tests you performed and their outcome*)
    
    • status: implementing --> testing
     

    Related

    Commit: [r416]

  • Erik Hänel

    Erik Hänel - 2018-11-14
    • assigned_to: Jonas Jansen --> Erik Hänel
     
  • Erik Hänel

    Erik Hänel - 2018-11-16
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -15,4 +15,4 @@
    
     * Language files: not needed
    
     ###Tests:
    -(*Describe, which tests you performed and their outcome*)
    +This fix was added to the automatic SW tests. No deviations detected.
    
    • status: testing --> fixed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB