[php-src] Issue #9228: readgzfile only writes to standard output
| From: | 8ctopus | Date: | Tue, 02 Aug 2022 13:24:51 +0000 |
| Subject: | [php-src] Issue #9228: readgzfile only writes to standard output | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242103@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9228
Author: 8ctopus
### Description
Currently
readgzfile() writes the file content to the standard output.
```php
readgzfile(string $filename, int $use_include_path = 0): int|false
```
It would be great if there was an easier way to write the file content to a variable, as for now
I'm using this not elegant workaround:
```php
ob_start();
readgzfile('/tmp/test.gz');
$content = ob_get_clean();
```
Here's my proposition:
```php
readgzfile(string $filename, int $use_include_path = 0, ?string &$content = null): int|false
```
Which would write to standard output if $content is null and to $content
otherwise.