Skip to content

Preloading has no defined io-stream constants #10673

@SCIF

Description

@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

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions