Skip to content

The script will unexpectedly exit when using php://stdout #17054

@f2h2h1

Description

@f2h2h1

Description

The following code:

php -a <<- 'EOF'
    echo 'start' . PHP_EOL;
    var_dump(fopen('php://stdout', 'w'));
    echo 'end' . PHP_EOL;
EOF

Resulted in this output:

start
resource(2) of type (stream)

But I expected this output instead:

start
resource(2) of type (stream)
end

This will produce output that meets expectations

php -r "echo('start'.PHP_EOL);var_dump(fopen('php://stdout','w'));echo('end'.PHP_EOL);"

but use php -a will accidentally exiting

Tested environment

  • OS: Windows 10
  • PHP: 8.1.26 NTS x64
  • Docker: NO
  • Shell: Bash

PHP Version

PHP: 8.1.26 NTS x64

Operating System

Windows 10

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