Browse Source

Start the pinning test server with a command string for PHP 7.3

proc_open() only accepts an array command as of PHP 7.4, so on 7.3 the
test server never started. Use a command string, with exec so that
proc_terminate() stops the server rather than just the shell.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
main
Aaron Parecki 1 day ago
parent
commit
edc5305cb3
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      tests/CurlPinningTest.php

+ 4
- 1
tests/CurlPinningTest.php View File

@ -13,8 +13,11 @@ class CurlPinningTest extends TestCase {
public static function setUpBeforeClass(): void {
self::$port = 20000 + random_int(0, 9999);
// A command string rather than an array, which proc_open only accepts as
// of PHP 7.4. exec replaces the shell with the server, so proc_terminate
// stops the server itself rather than just the shell.
self::$server = proc_open(
[PHP_BINARY, '-S', '127.0.0.1:' . self::$port, '-t', __DIR__ . '/server'],
'exec ' . escapeshellarg(PHP_BINARY) . ' -S 127.0.0.1:' . self::$port . ' -t ' . escapeshellarg(__DIR__ . '/server'),
[1 => ['file', '/dev/null', 'w'], 2 => ['file', '/dev/null', 'w']],
$pipes
);

Loading…
Cancel
Save