Explorar el Código

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

Alexander Kuzmenko hace 6 años
padre
commit
bbf423fe0b
Se han modificado 2 ficheros con 13 adiciones y 1 borrados
  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
         @see http://php.net/manual/en/language.oop5.cloning.php
      */
      */
     static inline function clone<T>(value:T):T {
     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);
+	}
+}