Skip to content

Commit 7575340

Browse files
committed
Merge branch 'PHP-7.4'
* PHP-7.4: Check ps -p availability in proc_nice test Set AI_CANONNAME flag in socket_addrinfo test Add ipv6 skipif to test Improve privilege check in pcntl_setpriority() test
2 parents 879525e + 25bdf9d commit 7575340

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

ext/pcntl/tests/pcntl_setpriority_basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ if (!extension_loaded('pcntl')) {
1111
if (!function_exists('pcntl_setpriority')) {
1212
die('skip pcntl_setpriority doesn\'t exist');
1313
}
14-
if (!function_exists('posix_getuid') || posix_getuid() !== 0) {
15-
die('skip this functions needs to run with superuser');
14+
if (@pcntl_setpriority(-5) === false && pcntl_get_last_error() == PCNTL_EACCES) {
15+
die('skip this function needs to run with CAP_SYS_NICE privileges');
1616
}
1717
?>
1818
--FILE--

ext/sockets/tests/socket_addrinfo_explain.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ if (!extension_loaded('sockets')) {
1010
$addrinfo = socket_addrinfo_lookup('127.0.0.1', 2000, array(
1111
'ai_family' => AF_INET,
1212
'ai_socktype' => SOCK_DGRAM,
13+
'ai_flags' => AI_CANONNAME,
1314
));
1415
var_dump(socket_addrinfo_explain($addrinfo[0]));
1516
echo "Done";
1617
--EXPECTF--
17-
array(5) {
18+
array(6) {
1819
["ai_flags"]=>
1920
int(%d)
2021
["ai_family"]=>
@@ -23,6 +24,8 @@ array(5) {
2324
int(2)
2425
["ai_protocol"]=>
2526
int(%d)
27+
["ai_canonname"]=>
28+
string(9) "127.0.0.1"
2629
["ai_addr"]=>
2730
array(2) {
2831
["sin_port"]=>

ext/sockets/tests/socket_sendrecvmsg_multi_msg.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ sendmsg()/recvmsg(): test ability to receive multiple messages (WIN32)
44
<?php
55
if (!extension_loaded('sockets'))
66
die('skip sockets extension not available.');
7+
8+
require 'ipv6_skipif.inc';
9+
710
if (!defined('IPPROTO_IPV6'))
811
die('skip IPv6 not available.');
912
/* Windows supports IPV6_RECVTCLASS and is able to receive the tclass via
1013
* WSARecvMsg (though only the top 6 bits seem to reported), but WSASendMsg
1114
* does not accept IPV6_TCLASS messages. We still test that sendmsg() works
1215
* correctly by sending an IPV6_PKTINFO message that will have no effect */
16+
?>
1317
--FILE--
1418
<?php
1519
include __DIR__."/mcast_helpers.php.inc";

ext/standard/tests/general_functions/proc_nice_basic.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ Simone Gentili (sensorario@gmail.com)
99
<?php
1010
if(!function_exists('proc_nice')) die("skip. proc_nice not available ");
1111
if(substr(strtoupper(PHP_OS), 0, 3) == 'WIN') die('skip. not for Windows');
12+
exec('ps -p 1 -o "pid,nice"', $output, $exit_code);
13+
if ($exit_code !== 0) {
14+
die("skip ps -p is not available");
15+
}
1216
?>
1317
--FILE--
1418
<?php

0 commit comments

Comments
 (0)