diff --git a/ext/openssl/tests/stream_socket_enable_crypto_method_option_type.phpt b/ext/openssl/tests/stream_socket_enable_crypto_method_option_type.phpt new file mode 100644 index 000000000000..7a12ac2a2428 --- /dev/null +++ b/ext/openssl/tests/stream_socket_enable_crypto_method_option_type.phpt @@ -0,0 +1,38 @@ +--TEST-- +stream_socket_enable_crypto() coerces the "crypto_method" context option to an integer +--EXTENSIONS-- +openssl +--FILE-- + +--EXPECT-- +int(0) +string(2) "16" +int(0) +string(2) "16" +int(0) +string(2) "16" diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index d1ed12a78c3a..00af949f677f 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -1598,7 +1598,7 @@ PHP_FUNCTION(stream_socket_enable_crypto) RETURN_THROWS(); } - cryptokind = Z_LVAL_P(val); + cryptokind = zval_get_long(val); } if (zsessstream) {