Skip to content

Commit e7fe91f

Browse files
committed
Fix patch, use pure socket client directly
1 parent e6cf05d commit e7fe91f

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

src/SPC/store/SourcePatcher.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,11 @@ public static function patchBeforeBuildconf(BuilderBase $builder): void
8787
}
8888

8989
// patch configure.ac
90+
$musl = SPCTarget::getLibc() === 'musl';
9091
FileSystem::replaceFileStr(
9192
SOURCE_PATH . '/php-src/configure.ac',
9293
'if command -v ldd >/dev/null && ldd --version 2>&1 | grep ^musl >/dev/null 2>&1',
93-
'if [ "$SPC_LIBC" = "musl" ];'
94+
'if ' . ($musl ? 'true' : 'false')
9495
);
9596
if (getenv('SPC_LIBC') === false && ($libc = SPCTarget::getLibc()) !== null) {
9697
putenv("SPC_LIBC={$libc}");

src/globals/ext-tests/openssl.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,25 @@
66
assert(openssl_digest('123456', 'md5') === 'e10adc3949ba59abbe56e057f20f883e');
77
if (file_exists('/etc/ssl/openssl.cnf')) {
88
$domain_list = [
9-
'https://captive.apple.com/',
10-
'https://detectportal.firefox.com/',
11-
'https://static-php.dev/',
12-
'https://www.example.com/',
9+
'captive.apple.com',
10+
'detectportal.firefox.com',
11+
'static-php.dev',
12+
'www.example.com',
1313
];
1414
$valid = false;
1515
foreach ($domain_list as $domain) {
16-
if (file_get_contents($domain) !== false) {
16+
$ssloptions = [
17+
'capture_peer_cert' => true,
18+
'capture_peer_cert_chain' => true,
19+
'allow_self_signed' => false,
20+
'CN_match' => $domain,
21+
'verify_peer' => true,
22+
'SNI_enabled' => true,
23+
'SNI_server_name' => $domain,
24+
];
25+
$context = stream_context_create(['ssl' => $ssloptions]);
26+
$result = stream_socket_client("ssl://{$domain}:443", $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);
27+
if ($result !== false) {
1728
$valid = true;
1829
break;
1930
}

0 commit comments

Comments
 (0)