com php-src: Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport: ext/stand ard/streamsfuncs.c
| From: | Anatol Belski | Date: | Mon, 12 May 2014 06:55:10 +0000 |
| Subject: | com php-src: Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport: ext/stand ard/streamsfuncs.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-78274@lists.php.net to get a copy of this message | ||
Commit: a582692720b0b8b857b755d507a982c130e3a425
Author: Anatol Belski <ab@php.net> Mon, 12 May 2014 08:55:10 +0200
Parents: ede2963963ba8ef88f9ab4df7e7ba0f26413d2bc 27f5957e9f5e8526033d946aaa02ad3bb07023b6
Branches: str_size_and_int64_56_backport
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=a582692720b0b8b857b755d507a982c130e3a425
Log:
Merge remote-tracking branch 'origin/PHP-5.6' into str_size_and_int64_56_backport
* origin/PHP-5.6:
Allow crypto_method context value in stream_socket_enable_crypto()
Conflicts:
ext/standard/streamsfuncs.c
Changed paths:
MM ext/standard/streamsfuncs.c
Diff:
diff --cc ext/standard/streamsfuncs.c
index efd53a3,68b4cce..3cb012d
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@@ -1488,19 -1490,30 +1490,30 @@@ PHP_FUNCTION(stream_set_read_buffer
Enable or disable a specific kind of crypto on the stream */
PHP_FUNCTION(stream_socket_enable_crypto)
{
- long cryptokind = 0;
+ php_int_t cryptokind = 0;
zval *zstream, *zsessstream = NULL;
php_stream *stream, *sessstream = NULL;
- zend_bool enable;
+ zend_bool enable, cryptokindnull;
int ret;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|ir", &zstream,
&enable, &cryptokind, &zsessstream) == FAILURE) {
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|l!r", &zstream,
&enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) {
++ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb|i!r", &zstream,
&enable, &cryptokind, &cryptokindnull, &zsessstream) == FAILURE) {
RETURN_FALSE;
}
php_stream_from_zval(stream, &zstream);
- if (ZEND_NUM_ARGS() >= 3) {
+ if (enable) {
+ if (ZEND_NUM_ARGS() < 3 || cryptokindnull) {
+ zval **val;
+
+ if (!GET_CTX_OPT(stream, "ssl", "crypto_method", val)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "When enabling encryption you must specify
the crypto type");
+ RETURN_FALSE;
+ }
+
- cryptokind = Z_LVAL_PP(val);
++ cryptokind = Z_IVAL_PP(val);
+ }
+
if (zsessstream) {
php_stream_from_zval(sessstream, &zsessstream);
}