Skip to content

wrong path succeeds in stream_context_set_options #22369

@Playit3110

Description

@Playit3110

Description

After Initiating a TCP-Server I wanted to enable TLS encryption with the following code:

$socket = stream_socket_server("tcp://0.0.0.0:8000", $errno, $errstr);


$options = [
    'ssl' => [
        'local_cert' => '/not/a/real/path/to/file.cert',
        'local_pk' => '/not/a/real/path/to/file.key',
    ],
];

echo stream_context_set_options($socket, $options);

After execution stream_context_set_options return true, even if the files for encrypting connections is missing

PHP Version

PHP 8.4.21 (cli) (built: May  7 2026 18:46:27) (NTS)
Copyright (c) The PHP Group
Built by Debian
Zend Engine v4.4.21, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.21, Copyright (c), by Zend Technologies

Operating System

Debian 13 Trixie

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions