Skip to content

Commit 987aee1

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: Revert "Add FPM prod idle timeout test"
2 parents e9853e4 + 69514e6 commit 987aee1

File tree

3 files changed

+14
-149
lines changed

3 files changed

+14
-149
lines changed

sapi/fpm/tests/proc-idle-timeout.phpt

Lines changed: 0 additions & 53 deletions
This file was deleted.

sapi/fpm/tests/status.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Status
8787
if ($startTimeTimestamp && $fields['start time'][0] === '\\') {
8888
$fields['start time'] = '\d+';
8989
}
90-
$pattern = '(' . $header;
90+
$pattern = '|' . $header;
9191
foreach ($fields as $name => $value) {
9292
if ($nameTransformer) {
9393
$name = call_user_func($nameTransformer, $name);
@@ -102,7 +102,7 @@ class Status
102102
}
103103
}
104104
$pattern = rtrim($pattern, $rowPattern[strlen($rowPattern) - 1]);
105-
$pattern .= $footer . ')';
105+
$pattern .= $footer . '|';
106106

107107
if (!preg_match($pattern, $body)) {
108108
echo "ERROR: Expected body does not match pattern\n";

sapi/fpm/tests/tester.inc

Lines changed: 12 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ class Tester
522522
}
523523

524524
/**
525-
* Get request params array.
525+
* Execute request.
526526
*
527527
* @param string $query
528528
* @param array $headers
@@ -531,13 +531,20 @@ class Tester
531531
* @param string|null $successMessage
532532
* @param string|null $errorMessage
533533
* @param bool $connKeepAlive
534-
* @return array
534+
* @return Response
535535
*/
536-
private function getRequestParams(
536+
public function request(
537537
string $query = '',
538538
array $headers = [],
539-
string $uri = null
539+
string $uri = null,
540+
string $address = null,
541+
string $successMessage = null,
542+
string $errorMessage = null,
543+
bool $connKeepAlive = false
540544
) {
545+
if ($this->hasError()) {
546+
return new Response(null, true);
547+
}
541548
if (is_null($uri)) {
542549
$uri = $this->makeSourceFile();
543550
}
@@ -564,38 +571,9 @@ class Tester
564571
],
565572
$headers
566573
);
567-
568-
return array_filter($params, function($value) {
574+
$params = array_filter($params, function($value) {
569575
return !is_null($value);
570576
});
571-
}
572-
573-
/**
574-
* Execute request.
575-
*
576-
* @param string $query
577-
* @param array $headers
578-
* @param string|null $uri
579-
* @param string|null $address
580-
* @param string|null $successMessage
581-
* @param string|null $errorMessage
582-
* @param bool $connKeepAlive
583-
* @return Response
584-
*/
585-
public function request(
586-
string $query = '',
587-
array $headers = [],
588-
string $uri = null,
589-
string $address = null,
590-
string $successMessage = null,
591-
string $errorMessage = null,
592-
bool $connKeepAlive = false
593-
) {
594-
if ($this->hasError()) {
595-
return new Response(null, true);
596-
}
597-
598-
$params = $this->getRequestParams($query, $headers, $uri);
599577

600578
try {
601579
$this->response = new Response(
@@ -616,66 +594,6 @@ class Tester
616594
return $this->response;
617595
}
618596

619-
/**
620-
* Execute multiple requests in parallel.
621-
*
622-
* @param array|int $requests
623-
* @param string|null $address
624-
* @param string|null $successMessage
625-
* @param string|null $errorMessage
626-
* @param bool $connKeepAlive
627-
* @return Response[]
628-
* @throws \Exception
629-
*/
630-
public function multiRequest(
631-
$requests,
632-
string $address = null,
633-
string $successMessage = null,
634-
string $errorMessage = null,
635-
bool $connKeepAlive = false
636-
) {
637-
if ($this->hasError()) {
638-
return new Response(null, true);
639-
}
640-
641-
if (is_numeric($requests)) {
642-
$requests = array_fill(0, $requests, []);
643-
} elseif (!is_array($requests)) {
644-
throw new \Exception('Requests can be either numeric or array');
645-
}
646-
647-
try {
648-
$connections = array_map(function ($requestData) use ($address, $connKeepAlive) {
649-
$client = $this->getClient($address, $connKeepAlive);
650-
$params = $this->getRequestParams(
651-
$requestData['query'] ?? '',
652-
$requestData['headers'] ?? [],
653-
$requestData['uri'] ?? null
654-
);
655-
return [
656-
'client' => $client,
657-
'requestId' => $client->async_request($params, false),
658-
];
659-
}, $requests);
660-
661-
$responses = array_map(function ($conn) {
662-
$response = new Response($conn['client']->wait_for_response_data($conn['requestId']));
663-
if ($this->debug) {
664-
$response->debugOutput();
665-
}
666-
return $response;
667-
}, $connections);
668-
$this->message($successMessage);
669-
return $responses;
670-
} catch (\Exception $exception) {
671-
if ($errorMessage === null) {
672-
$this->error("Request failed", $exception);
673-
} else {
674-
$this->message($errorMessage);
675-
}
676-
}
677-
}
678-
679597
/**
680598
* Get client.
681599
*

0 commit comments

Comments
 (0)