Prechádzať zdrojové kódy

php: fixed EReg.replace (issue 194)

Franco Ponticelli 15 rokov pred
rodič
commit
a140fe7dcf
2 zmenil súbory, kde vykonal 4 pridanie a 2 odobranie
  1. 2 1
      doc/CHANGES.txt
  2. 2 1
      std/php/_std/EReg.hx

+ 2 - 1
doc/CHANGES.txt

@@ -8,7 +8,8 @@
 	flash9 : fixed TypedDictionary.exists
 	all : added @:build for enums
 	neko : Std.parseFloat now returns NaN with invalid string
-	php: fixed Array.push must return the current length
+	php: fixed Array.push must return the current length (issue 219)
+	php: fixed EReg.replace (issue 194)
 
 2010-08-14: 2.06
 	neko : change serializer to be able to handle instances of basic classes from other modules

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

@@ -81,9 +81,10 @@
 	}
 
 	public function replace( s : String, by : String ) : String {
+		by = untyped __call__("str_replace", "\\$", "\\\\$", by);
 		by = untyped __call__("str_replace", "$$", "\\$", by);
 		untyped __php__("if(!preg_match('/\\\\([^?].+?\\\\)/', $this->re)) $by = preg_replace('/\\$(\\d+)/', '\\\\\\$\\1', $by)");
-		return untyped __php__("preg_replace")(re, by, s, global ? -1 : 1);
+		return untyped __call__("preg_replace", re, by, s, global ? -1 : 1);
 	}
 
 	public function customReplace( s : String, f : EReg -> String ) : String {