Browse Source

[php] optimize out of bounds Array write

Aleksandr Kuzmenko 6 years ago
parent
commit
48c17b0a01
1 changed files with 2 additions and 2 deletions
  1. 2 2
      std/php/_std/Array.hx

+ 2 - 2
std/php/_std/Array.hx

@@ -211,8 +211,8 @@ final class Array<T> implements ArrayAccess<Int, T> {
 	@:noCompletion
 	function offsetSet(offset:Int, value:T):Void {
 		if (length <= offset) {
-			if (length < offset) {
-				arr = Global.array_pad(arr, offset + 1, null);
+			for(i in length...offset + 1) {
+				arr[i] = null;
 			}
 			length = offset + 1;
 		}