com php-src: test to function stream_socket_enable_crypto ();: ext/standard/tests/streams/stream_socket_ena ble_crypto.phpt

From: Date: Thu, 24 Dec 2015 09:50:54 +0000
Subject: com php-src: test to function stream_socket_enable_crypto ();: ext/standard/tests/streams/stream_socket_ena ble_crypto.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90446@lists.php.net to get a copy of this message
Commit: 7e399566a7c94ce00561fb7bbd11f27475d83df2 Author: marcosptf <marcosptf@yahoo.com.br> Fri, 11 Dec 2015 10:56:49 -0200 Committer: Julien Pauli <jpauli@php.net> Thu, 24 Dec 2015 10:50:54 +0100 Parents: a7daf97198563cfa9fb8e1357e3d3b9b9cfbc352 Branches: PHP-5.6 PHP-7..0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7e399566a7c94ce00561fb7bbd11f27475d83df2 Log: test to function stream_socket_enable_crypto(); Changed paths: A ext/standard/tests/streams/stream_socket_enable_crypto.phpt Diff: diff --git a/ext/standard/tests/streams/stream_socket_enable_crypto.phpt b/ext/standard/tests/streams/stream_socket_enable_crypto.phpt new file mode 100644 index 0000000..fa5ab54 --- /dev/null +++ b/ext/standard/tests/streams/stream_socket_enable_crypto.phpt @@ -0,0 +1,64 @@ +--TEST-- +mixed stream_socket_enable_crypto(resource $stream , bool $enable [, int $crypto_type [, resource $session_stream ]] ) ; +--CREDITS-- +marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--SKIPIF-- +<?php +if (phpversion() < "5.3.0") { die('SKIP php version so lower.'); } +?> +--FILE-- +<?php +$serverUri = "tcp://127.0.0.1:31854"; +$sock = stream_socket_server($serverUri, $errno, $errstr); + +if (is_resource($sock)) { + var_dump(stream_socket_enable_crypto($sock, false)); + var_dump(stream_socket_enable_crypto($sock, true)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv2_CLIENT)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv3_CLIENT)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv23_CLIENT)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv2_SERVER)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv3_SERVER)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER)); + var_dump(stream_socket_enable_crypto($sock, true, STREAM_CRYPTO_METHOD_TLS_SERVER)); +} else { + die("Test stream_socket_enable_crypto has failed; Unable to connect: {$errstr} ({$errno})"); +} +?> +--CLEAN-- +<?php +unset($serverUri); +unset($sock); +unset($errno); +unset($errstr); +?> +--EXPECTF-- +bool(false) + +Warning: stream_socket_enable_crypto(): When enabling encryption you must specify the crypto type in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSLv2 unavailable in the OpenSSL library against which PHP is linked in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSL: Broken pipe in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d +bool(false) + +Warning: stream_socket_enable_crypto(): SSL/TLS already set-up for this stream in %s on line %d +bool(false)

« previous php.cvs (#90446) next »