From 3ff8333473f79fe8255fd2e0781cd3477ebe6a25 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Wed, 8 Feb 2023 00:54:42 +0100 Subject: [PATCH] Cleanup dead code in array_slice (#10539) We can only get to this if condition if at least preserve_keys is true. Therefore, the else branch of this check can never execute. --- ext/standard/array.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ext/standard/array.c b/ext/standard/array.c index a1fe8287cd3..88d2335c0af 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -3616,11 +3616,7 @@ PHP_FUNCTION(array_slice) break; } n++; - if (preserve_keys) { - entry = zend_hash_index_add_new(Z_ARRVAL_P(return_value), idx, zv); - } else { - entry = zend_hash_next_index_insert_new(Z_ARRVAL_P(return_value), zv); - } + entry = zend_hash_index_add_new(Z_ARRVAL_P(return_value), idx, zv); zval_add_ref(entry); } }