Skip to content

Commit 6d28b21

Browse files
committed
MQE-522: Fixed warnings for length has to be greater than zero for substr_count() when using php < 7.1.
1 parent a5e371d commit 6d28b21

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Magento/FunctionalTestingFramework/Util/TestGenerator.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -980,9 +980,13 @@ private function processQuoteBreaks($match, $argument, $replacement)
980980
$beforeIndex = strpos($outputArg, $match) - 1;
981981
$afterIndex = $beforeIndex + strlen($match) + 1;
982982

983+
$quoteBefore = false;
983984
// Determine if there is a " before/after the $match, and if there is only one " before/after match.
984-
$quoteBefore = $argument[$beforeIndex] == '"' && substr_count($argument, '"', 0, $beforeIndex)<1;
985-
$quoteAfter = $argument[$afterIndex] == '"' && substr_count($argument, '"', $afterIndex+1)<1;
985+
if ($beforeIndex == 0
986+
|| ($argument[$beforeIndex] == '"' && substr_count($argument, '"', 0, $beforeIndex) < 1)) {
987+
$quoteBefore = true;
988+
}
989+
$quoteAfter = $argument[$afterIndex] == '"' && substr_count($argument, '"', $afterIndex+1) < 1;
986990

987991
//Remove quotes at either end of argument if they aren't necessary. Add double-quote concatenation if needed.
988992
if ($quoteBefore) {

0 commit comments

Comments
 (0)