Browse Source

[php] fix String.lastIndexOf(s, startIndex) for startIndex > s.length

Alexander Kuzmenko 7 years ago
parent
commit
eafc67cf36
1 changed files with 3 additions and 0 deletions
  1. 3 0
      std/php/Boot.hx

+ 3 - 0
std/php/Boot.hx

@@ -694,6 +694,9 @@ private class HxString {
 			startIndex = 0;
 			startIndex = 0;
 		} else {
 		} else {
 			startIndex = startIndex - str.length;
 			startIndex = startIndex - str.length;
+			if(startIndex > 0) {
+				startIndex = 0;
+			}
 		}
 		}
 		var index = Global.mb_strrpos(str, search, startIndex, 'UTF-8');
 		var index = Global.mb_strrpos(str, search, startIndex, 'UTF-8');
 		if (index == false) {
 		if (index == false) {