[php-src] Issue #10673: Preloading has no defined io-stream constants
| From: | SCIF | Date: | Thu, 23 Feb 2023 01:02:01 +0000 |
| Subject: | [php-src] Issue #10673: Preloading has no defined io-stream constants | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-243789@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/10673
Author: SCIF
### Description
As of https://www.php.net/manual/en/features.commandline.io-streams.php
, there should be constants defined in CLI.
Added the following to
preload.ini:
```
opcache.preload_user=www-data
opcache.preload=/path/to/preload.php
```
The following code wrote to preload.php:
```php
<?php
var_dump(defined('STDIN'));
var_dump(defined('STDOUT'));
var_dump(defined('STDERR'));
```
Resulted in this output:
```
/path/to/preload.php:3:
bool(false)
/path/to/preload.php:4:
bool(false)
/path/to/preload.php:5:
bool(false)
```
But I expected this output instead:
```
/path/to/preload.php:3:
bool(true)
/path/to/preload.php:4:
bool(true)
/path/to/preload.php:5:
bool(true)
```
I could imagine this is the expected behavior but docs should be updated then. :) There are no
restrictions defined in https://www.php.net/manual/en/opcache.preloading.php
BTW, the opcache_enabled shown as false for
var_dump(opcache_get_status(false));.
### PHP Version
8.1.16
### Operating System
Docker image: php:8.1-fpm-bullseye