Skip to content

Commit 7746ed9

Browse files
committed
Merge branch 'PHP-7.0' into PHP-7.1
2 parents f4d884d + 78675eb commit 7746ed9

File tree

2 files changed

+36
-21
lines changed

2 files changed

+36
-21
lines changed

ext/opcache/tests/php_cli_server.inc

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,43 @@ function php_cli_server_start($ini = "") {
2020
$cmd = "exec {$php_executable} -t {$doc_root} $ini -S " . PHP_CLI_SERVER_ADDRESS . " 2>/dev/null";
2121
$handle = proc_open($cmd, $descriptorspec, $pipes, $doc_root);
2222
}
23-
23+
2424
// note: even when server prints 'Listening on localhost:8964...Press Ctrl-C to quit.'
2525
// it might not be listening yet...need to wait until fsockopen() call returns
26-
$i = 0;
27-
while (($i++ < 30) && !($fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT))) {
28-
usleep(10000);
29-
}
26+
$error = "Unable to connect to servers\n";
27+
for ($i=0; $i < 60; $i++) {
28+
usleep(25000); // 25ms per try
29+
$status = proc_get_status($handle);
30+
$fp = @fsockopen(PHP_CLI_SERVER_HOSTNAME, PHP_CLI_SERVER_PORT);
31+
// Failure, the server is no longer running
32+
if (!($status && $status['running'])) {
33+
$error = "Server is not running\n";
34+
break;
35+
}
36+
// Success, Connected to servers
37+
if ($fp) {
38+
$error = '';
39+
break;
40+
}
41+
}
3042

31-
if ($fp) {
32-
fclose($fp);
33-
}
43+
if ($fp) {
44+
fclose($fp);
45+
}
46+
47+
if ($error) {
48+
echo $error;
49+
proc_terminate($handle);
50+
exit(1);
51+
}
3452

3553
register_shutdown_function(
3654
function($handle) {
3755
proc_terminate($handle);
3856
},
39-
$handle
40-
);
41-
// don't bother sleeping, server is already up
42-
// server can take a variable amount of time to be up, so just sleeping a guessed amount of time
43-
// does not work. this is why tests sometimes pass and sometimes fail. to get a reliable pass
44-
// sleeping doesn't work.
57+
$handle
58+
);
59+
4560
}
4661
?>
4762

ext/openssl/tests/openssl_pkey_new_basic.phpt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ $details = openssl_pkey_get_details($dh);
8686
$dh_details = $details['dh'];
8787
openssl_pkey_test_cmp($phex, $dh_details['p']);
8888
var_dump($dh_details['g']);
89-
var_dump(strlen($dh_details['pub_key']) > 0);
90-
var_dump(strlen($dh_details['priv_key']) > 0);
89+
var_dump(strlen($dh_details['pub_key']));
90+
var_dump(strlen($dh_details['priv_key']));
9191
?>
92-
--EXPECT--
92+
--EXPECTF--
9393
int(0)
9494
int(0)
9595
int(0)
@@ -98,9 +98,9 @@ int(0)
9898
int(0)
9999
int(0)
100100
int(0)
101-
int(20)
102-
int(128)
101+
int(%d)
102+
int(%d)
103103
int(0)
104104
string(1) "2"
105-
bool(true)
106-
bool(true)
105+
int(%d)
106+
int(%d)

0 commit comments

Comments
 (0)