[php-src] Issue #21705: `ZipArchive::getFromIndex()` ignores `ZipArchive::FL_UNCHANGED` for deleted entries

[email protected] (LamentXU123)
Newsgroups php.bugs
Message-ID <[email protected]>
Issue: https://github.com/php/php-src/issues/21705
Author: LamentXU123

### Description

The following code:

```php
<?php
$name = __DIR__ . '/test.zip';
@unlink($name);
$zip = new ZipArchive;
$zip->open($name, ZipArchive::CREATE);
$zip->addFromString('foo.txt', 'foo');
$zip->addFromString('bar.txt', 'bar');
$zip->close();

$zip = new ZipArchive;
$zip->open($name);

$index = $zip->locateName('bar.txt');
$zip->deleteName('bar.txt');

var_dump($zip->getFromName('bar.txt', 0, ZipArchive::FL_UNCHANGED));
var_dump($zip->getFromIndex($index, 0, ZipArchive::FL_UNCHANGED));

$zip->close();
@unlink($name);
?>
```

Resulted in this output:
```
string(3) "bar"
bool(false)
```

But I expected this output instead:
```
string(3) "bar"
string(3) "bar"
```

Seems like `ZipArchive::getFromIndex()` accepts a `$flags` argument, but in `ext/zip/php_zip.c` the index lookup path does not pass those flags to `zip_stat_index()`. `getFromName()` works, but `getFromIndex()` does not honor FL_UNCHANGED.

### PHP Version

```plain
all supported version
```

### Operating System

_No response_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.