浏览代码

[php] fixed List.pop() (fixes #6859)

Alexander Kuzmenko 7 年之前
父节点
当前提交
cedf04b223
共有 2 个文件被更改,包括 15 次插入1 次删除
  1. 1 1
      std/php/_std/List.hx
  2. 14 0
      tests/unit/src/unit/issues/Issue6859.hx

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

@@ -60,7 +60,7 @@
 		if( h == null )
 			return null;
 		var x = h[0];
-		h = h[1];
+		untyped __php__("$this->h =& $this->h[1]");
 		if( h == null )
 			q = null;
 		length--;

+ 14 - 0
tests/unit/src/unit/issues/Issue6859.hx

@@ -0,0 +1,14 @@
+package unit.issues;
+
+class Issue6859 extends unit.Test {
+	function test() {
+		var l = new List();
+        l.add(42);
+        l.add(42);
+        l.pop();
+        l.add(42);
+        l.pop();
+        l.pop();
+        eq(0, l.length);
+	}
+}