diff options
| author | Anatol Belski <ab@php.net> | 2016-01-04 17:07:37 +0100 |
|---|---|---|
| committer | Anatol Belski <ab@php.net> | 2016-01-04 17:07:37 +0100 |
| commit | a09e65d2b8998570ede0459329e5323afca1faaf (patch) | |
| tree | 5617c49e9cc1f7dacdcd72423293907df507470b /ext/sockets | |
| parent | 56bf10f0bd9a1b2d88b4cb2ac6e45ebf46925adc (diff) | |
| parent | 36b4311edd3e2dec31de1582c207e83b09d6f42b (diff) | |
| download | php-git-a09e65d2b8998570ede0459329e5323afca1faaf.tar.gz | |
Merge remote-tracking branch 'php/PHP-7.0' into PHP-7.0
* php/PHP-7.0: (115 commits)
Do not edit the value in place (might be relates to #71261)
Fixed bug #71264 (file_put_contents() returns unexpected value when filesystem runs full)
Duplicated i
remove duplicated skipif conditions
bump year which is missed in rev 49493a2
bump year which is missed in rev 49493a2
sync with new tests from 7.0 for ICU 55_1 and 56_1 compat
sync skipifs for ext/intl for ICU 55_* and 56_* compat
Update header to PHP Version 7
Happy new year (Update copyright to 2016)
Happy new year (Update copyright to 2016)
Happy new year (Update copyright to 2016)
Fixed bug #71249 (ldap_mod_replace/ldap_mod_add store value as string "Array")
Fixed test after fix lineno of finally
MFH: Fix lineno for finally FAST_CALL and JMP
This should be better
Fixed bug #71245 (file_get_contents() ignores "header" context option if it's a reference)
Fixed info while setting opcache.file_cache_only
Drop extra line
Add CVE for #71105 (PHP 7.0.1)
...
Diffstat (limited to 'ext/sockets')
| -rw-r--r-- | ext/sockets/multicast.c | 2 | ||||
| -rw-r--r-- | ext/sockets/multicast.h | 2 | ||||
| -rw-r--r-- | ext/sockets/php_sockets.h | 2 | ||||
| -rw-r--r-- | ext/sockets/sendrecvmsg.c | 2 | ||||
| -rw-r--r-- | ext/sockets/sockets.c | 2 | ||||
| -rw-r--r-- | ext/sockets/tests/socket_clear_error.phpt | 28 | ||||
| -rw-r--r-- | ext/sockets/tests/socket_getopt.phpt | 73 | ||||
| -rw-r--r-- | ext/sockets/tests/socket_send.phpt | 50 | ||||
| -rw-r--r-- | ext/sockets/tests/socket_shutdown.phpt | 54 | ||||
| -rw-r--r-- | ext/sockets/unix_socket_constants.h | 2 | ||||
| -rw-r--r-- | ext/sockets/win32_socket_constants.h | 2 | ||||
| -rw-r--r-- | ext/sockets/windows_common.h | 2 |
12 files changed, 213 insertions, 8 deletions
diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c index a0d3e132a1..6d37bfb1dd 100644 --- a/ext/sockets/multicast.c +++ b/ext/sockets/multicast.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/sockets/multicast.h b/ext/sockets/multicast.h index 49ae5dff27..29ef05567a 100644 --- a/ext/sockets/multicast.h +++ b/ext/sockets/multicast.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h index 5dcbd29eef..c6636aaa24 100644 --- a/ext/sockets/php_sockets.h +++ b/ext/sockets/php_sockets.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c index cccaf4c407..7471ad143a 100644 --- a/ext/sockets/sendrecvmsg.c +++ b/ext/sockets/sendrecvmsg.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c index 39bfd2bf49..6de9ab1fe7 100644 --- a/ext/sockets/sockets.c +++ b/ext/sockets/sockets.c @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/sockets/tests/socket_clear_error.phpt b/ext/sockets/tests/socket_clear_error.phpt new file mode 100644 index 0000000000..af9acaa9bf --- /dev/null +++ b/ext/sockets/tests/socket_clear_error.phpt @@ -0,0 +1,28 @@ +--TEST-- +void socket_clear_error ([ resource $socket ] ) ; +--CREDITS-- +marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('SKIP sockets extension not available.'); +} +?> +--FILE-- +<?php +$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +$socketConn = socket_connect($socket, "127.0.0.1", 21248); +var_dump(socket_last_error($socket)); +socket_clear_error($socket); +var_dump(socket_last_error($socket)); +?> +--CLEAN-- +<?php +socket_close($socket); +unset($socket); +unset($socketConn); +?> +--EXPECTF-- +Warning: socket_connect(): unable to connect [%d]: Connection refused in %s on line %d +int(%d) +int(%d) diff --git a/ext/sockets/tests/socket_getopt.phpt b/ext/sockets/tests/socket_getopt.phpt new file mode 100644 index 0000000000..12c0aeb888 --- /dev/null +++ b/ext/sockets/tests/socket_getopt.phpt @@ -0,0 +1,73 @@ +--TEST-- +mixed socket_getopt( resource $socket , int $level , int $optname ) ; +--CREDITS-- +marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('skip sockets extension not available.'); +} +?> +--FILE-- +<?php +$domain = AF_INET; +$level = IPPROTO_IP; +$s = socket_create($domain, SOCK_DGRAM, SOL_UDP) or die("err"); + +echo "Setting IP_MULTICAST_TTL\n"; +$r = socket_set_option($s, $level, IP_MULTICAST_TTL, 9); +var_dump($r); +$r = socket_getopt($s, $level, IP_MULTICAST_TTL); +var_dump($r); +echo "\n"; + +echo "Setting IP_MULTICAST_LOOP\n"; +$r = socket_set_option($s, $level, IP_MULTICAST_LOOP, 0); +var_dump($r); +$r = socket_getopt($s, $level, IP_MULTICAST_LOOP); +var_dump($r); +$r = socket_set_option($s, $level, IP_MULTICAST_LOOP, 1); +var_dump($r); +$r = socket_getopt($s, $level, IP_MULTICAST_LOOP); +var_dump($r); +echo "\n"; + +echo "Setting IP_MULTICAST_IF\n"; +echo "interface 0:\n"; +$r = socket_set_option($s, $level, IP_MULTICAST_IF, 0); +var_dump($r); +$r = socket_getopt($s, $level, IP_MULTICAST_IF); +var_dump($r); +echo "interface 1:\n"; +$r = socket_set_option($s, $level, IP_MULTICAST_IF, 1); +var_dump($r); +$r = socket_getopt($s, $level, IP_MULTICAST_IF); +var_dump($r); +echo "\n"; +?> +--CLEAN-- +<?php +unset($domain); +unset($level); +socket_close($s); +unset($s); +unset($r"); +?> +--EXPECT-- +Setting IP_MULTICAST_TTL +bool(true) +int(9) + +Setting IP_MULTICAST_LOOP +bool(true) +int(0) +bool(true) +int(1) + +Setting IP_MULTICAST_IF +interface 0: +bool(true) +int(0) +interface 1: +bool(true) +int(1) diff --git a/ext/sockets/tests/socket_send.phpt b/ext/sockets/tests/socket_send.phpt new file mode 100644 index 0000000000..1411868c4b --- /dev/null +++ b/ext/sockets/tests/socket_send.phpt @@ -0,0 +1,50 @@ +--TEST-- +int socket_send ( resource $socket , string $buf , int $len , int $flags ); +--CREDITS-- +marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('SKIP sockets extension not available.'); +} +?> +--FILE-- +<?php +$port = 80; +$host = "yahoo.com"; +$stringSocket = "send_socket_to_connected_socket"; +$stringSocketLenght = strlen($stringSocket); + +$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +$socketConn = socket_connect($socket, $host, $port); + +if(socket_send($socket, $stringSocket, $stringSocketLenght, MSG_OOB)===$stringSocketLenght){ + print("okey\n"); +} + +if(socket_send($socket, $stringSocket, $stringSocketLenght, MSG_EOR)===$stringSocketLenght){ + print("okey\n"); +} + +if(socket_send($socket, $stringSocket, $stringSocketLenght, MSG_EOF)===$stringSocketLenght){ + print("okey\n"); +} + +if(socket_send($socket, $stringSocket, $stringSocketLenght, MSG_DONTROUTE)===$stringSocketLenght){ + print("okey\n"); +} +?> +<?php +socket_close($socket); +unset($port); +unset($host); +unset($stringSocket); +unset($stringSocketLenght); +unset($socket); +unset($socketConn); +?> +--EXPECTF-- +okey +okey +okey +okey diff --git a/ext/sockets/tests/socket_shutdown.phpt b/ext/sockets/tests/socket_shutdown.phpt new file mode 100644 index 0000000000..09f5ac73fc --- /dev/null +++ b/ext/sockets/tests/socket_shutdown.phpt @@ -0,0 +1,54 @@ +--TEST-- +bool socket_shutdown ( resource $socket [, int $how = 2 ] ) ; +--CREDITS-- +marcosptf - <marcosptf@yahoo.com.br> - #phparty7 - @phpsp - novatec/2015 - sao paulo - br +--SKIPIF-- +<?php +if (!extension_loaded('sockets')) { + die('SKIP sockets extension not available.'); +} +?> +--FILE-- +<?php +$host = "yahoo.com"; +$port = 80; + +$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +$socketConn = socket_connect($socket, $host, $port); +var_dump(socket_shutdown($socket,0)); +socket_close($socket); + +$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +$socketConn = socket_connect($socket, $host, $port); +var_dump(socket_shutdown($socket,1)); +socket_close($socket); + +$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +$socketConn = socket_connect($socket, $host, $port); +var_dump(socket_shutdown($socket,2)); +socket_close($socket); + +$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); +var_dump(socket_shutdown($socket,0)); + +$socketConn = socket_connect($socket, $host, $port); +var_dump(socket_shutdown($socket,-1)); +socket_close($socket); +?> +--CLEAN-- +<?php +unset($host); +unset($port); +unset($socket); +unset($socketConn); +?> +--EXPECTF-- +bool(true) +bool(true) +bool(true) + +Warning: socket_shutdown(): unable to shutdown socket [%d]: Transport endpoint is not connected in %s on line %d +bool(false) + +Warning: socket_shutdown(): unable to shutdown socket [%d]: Invalid argument in %s on line %d +bool(false) diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h index e88c5b330e..b8f48fdaa8 100644 --- a/ext/sockets/unix_socket_constants.h +++ b/ext/sockets/unix_socket_constants.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h index 7060d8b457..302ffeff54 100644 --- a/ext/sockets/win32_socket_constants.h +++ b/ext/sockets/win32_socket_constants.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | diff --git a/ext/sockets/windows_common.h b/ext/sockets/windows_common.h index 04cc1f0825..4e98d96be0 100644 --- a/ext/sockets/windows_common.h +++ b/ext/sockets/windows_common.h @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 7 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2015 The PHP Group | + | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | |
