Selaa lähdekoodia

[php] Added parentheses for `Syntax.clone()` implementation (fixes #7590)

Alexander Kuzmenko 6 vuotta sitten
vanhempi
commit
bbf423fe0b
2 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  1. 1 1
      std/php/Syntax.hx
  2. 12 0
      tests/unit/src/unit/issues/Issue7590.hx

+ 1 - 1
std/php/Syntax.hx

@@ -292,7 +292,7 @@ extern class Syntax {
         @see http://php.net/manual/en/language.oop5.cloning.php
      */
     static inline function clone<T>(value:T):T {
-        return Syntax.code('clone {0}', value);
+        return Syntax.code('(clone {0})', value);
     }
 
     /**

+ 12 - 0
tests/unit/src/unit/issues/Issue7590.hx

@@ -0,0 +1,12 @@
+package unit.issues;
+
+class Issue7590 extends unit.Test {
+	function test() {
+		var array = [0, 1, 2, 3, 4, 5];
+		for (k in array.copy().iterator()) {
+			array.remove(k);
+		}
+
+		aeq([], array);
+	}
+}