Preloading has no defined io-stream constants
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
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
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report using preload.ini and preload.php in the PHP 8.1.16 php:8.1-fpm-bullseye image, then compare the result with the CLI I/O streams and opcache preloading documentation linked in the issue. Determine whether STDIN, STDOUT, and STDERR should be defined during preloading; done means either the behavior works as expected or the documentation clearly states the restriction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100