Commit 04c41f04455 for php.net

commit 04c41f04455361156e173a0f2d79a153483450ad
Merge: e79d7e55676 718409371c5
Author: David Carlier <devnexen@gmail.com>
Date:   Fri Sep 11 18:19:10 2026 +0100

    Merge branch 'PHP-8.5'

    * PHP-8.5:
      ext/zip: ZipArchive::extractTo() ignores files given in a non-list array

    # Conflicts:
    #       ext/zip/php_zip.c

diff --cc ext/zip/php_zip.c
index 7af8a81e8f6,40ba748129c..93004531dac
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@@ -2920,8 -2918,7 +2920,8 @@@ PHP_METHOD(ZipArchive, extractTo
  		}
  	}

- 	uint32_t nelems, i;
+ 	uint32_t nelems;
 +	ZIP_FROM_OBJECT(intern, self);

  	if (files_str) {
  		if (!php_zip_extract_file(intern, pathto, ZSTR_VAL(files_str), ZSTR_LEN(files_str), -1)) {
@@@ -2932,19 -2929,19 +2932,18 @@@
  		if (nelems == 0 ) {
  			RETURN_FALSE;
  		}
- 		for (i = 0; i < nelems; i++) {
- 			zval *zval_file;
- 			if ((zval_file = zend_hash_index_find_deref(files_ht, i)) != NULL) {
- 				if (Z_TYPE_P(zval_file) == IS_STRING) {
- 						if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
- 							RETURN_FALSE;
- 						}
- 				} else {
- 						zend_argument_type_error(2, "must only have elements of type string, %s given", zend_zval_value_name(zval_file));
- 						RETURN_THROWS();
+ 		zval *zval_file;
+ 		ZEND_HASH_FOREACH_VAL(files_ht, zval_file) {
+ 			ZVAL_DEREF(zval_file);
 -			switch (Z_TYPE_P(zval_file)) {
 -				case IS_LONG:
 -					break;
 -				case IS_STRING:
 -					if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
 -						RETURN_FALSE;
 -					}
 -					break;
++			if (Z_TYPE_P(zval_file) == IS_STRING) {
++				if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_file), Z_STRLEN_P(zval_file), -1)) {
++					RETURN_FALSE;
 +				}
++			} else {
++				zend_argument_type_error(2, "must only have elements of type string, %s given", zend_zval_value_name(zval_file));
++				RETURN_THROWS();
  			}
- 		}
+ 		} ZEND_HASH_FOREACH_END();
  	} else {
  		/* Extract all files */
  		zip_int64_t i, filecount = zip_get_num_entries(intern, 0);