Explorar o código

[php] minor fix of EReg.map for unicode strings and empty matches (#8861)

Aleksandr Kuzmenko %!s(int64=5) %!d(string=hai) anos
pai
achega
860c0d70d5
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 1 1
      std/php/Boot.hx
  2. 1 1
      std/php/_std/EReg.hx

+ 1 - 1
std/php/Boot.hx

@@ -616,7 +616,7 @@ class Boot {
 	}
 
 	/**
-		Get UTF-8 code of che first character in `s` without any checks
+		Get UTF-8 code of the first character in `s` without any checks
 	**/
 	static public inline function unsafeOrd(s:NativeString):Int {
 		var code = Global.ord(s[0]);

+ 1 - 1
std/php/_std/EReg.hx

@@ -158,7 +158,7 @@ import php.*;
 			result += f(this);
 			bytesOffset = matches[0][1];
 			if(matches[0][0] == '') {
-				result += Global.substr(s, bytesOffset, 1);
+				result += Global.mb_substr(Global.substr(s, bytesOffset), 0, 1);
 				bytesOffset++;
 			} else {
 				bytesOffset += Global.strlen(matches[0][0]);