@@ -913,6 +913,7 @@ private function resolveTestVariable($inputString, $args)
913
913
*/
914
914
private function replaceMatchesIntoArg ($ matches , &$ outputArg , $ delimiter )
915
915
{
916
+ // Remove Duplicate $matches from array. Duplicate matches are replaced all in one go.
916
917
$ matches = array_unique ($ matches );
917
918
foreach ($ matches as $ match ) {
918
919
$ replacement = null ;
@@ -951,17 +952,12 @@ private function processQuoteBreaks($match, $argument, $replacement)
951
952
$ outputArg = $ argument ;
952
953
$ beforeIndex = strpos ($ outputArg , $ match ) - 1 ;
953
954
$ afterIndex = $ beforeIndex + strlen ($ match ) + 1 ;
954
- $ quoteBefore = true ;
955
- $ quoteAfter = true ;
956
955
957
- // Determine if there is a Single quote before/after the $match, and if there is only 1 quote before/after.
958
- if ($ argument [$ beforeIndex ] != '" ' || substr_count ($ argument , '" ' , 0 , $ beforeIndex +1 )>1 ) {
959
- $ quoteBefore = false ;
960
- }
961
- if ($ argument [$ afterIndex ] != '" ' || substr_count ($ argument , '" ' , $ afterIndex )>1 ) {
962
- $ quoteAfter = false ;
963
- }
964
- //Remove quotes at either end of argument if they aren't necessary. Add quote breaking if needed
956
+ // Determine if there is a " before/after the $match, and if there is only one " before/after match.
957
+ $ quoteBefore = $ argument [$ beforeIndex ] == '" ' && substr_count ($ argument , '" ' , 0 , $ beforeIndex +1 )<1 ;
958
+ $ quoteAfter = $ argument [$ afterIndex ] == '" ' && substr_count ($ argument , '" ' , $ afterIndex )<1 ;
959
+
960
+ //Remove quotes at either end of argument if they aren't necessary. Add double-quote concatenation if needed.
965
961
if ($ quoteBefore ) {
966
962
$ outputArg = substr ($ outputArg , 0 , $ beforeIndex ) . substr ($ outputArg , $ beforeIndex +1 );
967
963
$ afterIndex --;
0 commit comments