[php-src] PR #25764: Fix stream_socket_enable_crypto() reading the crypto_method option without a type check

From: Date: Wed, 25 Nov 2026 22:04:44 +0000
Subject: [php-src] PR #25764: Fix stream_socket_enable_crypto() reading the crypto_method option without a type check
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41022@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25764 Author: lacatoire stream_socket_enable_crypto() reads the crypto_method context option with Z_LVAL_P() without a type check, so a numeric string or a float gives a garbage method. Use zval_get_long(), as the ssl:// transport does. ```php <?php $listener = stream_socket_server('tcp://127.0.0.1:0'); $client = stream_socket_client('tcp://' . stream_socket_get_name($listener, false)); $server = stream_socket_accept($listener); stream_set_timeout($server, 1); stream_set_blocking($client, false); stream_context_set_option($client, 'ssl', 'crypto_method', (string) STREAM_CRYPTO_METHOD_TLS_CLIENT); stream_socket_enable_crypto($client, true); var_dump(bin2hex(fread($server, 1))); ``` Before: string(0) "". After: string(2) "16".

« previous php.git-pulls (#41022) next »