From f449b2d8a64f9376599f1ce1f6fd31914dc87645 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Thu, 22 Oct 2026 11:52:53 +0800 Subject: [PATCH] fix: silence expected net-snmp legacy provider warning net-snmp 5.10 logs "Failed to load OpenSSL legacy provider" from snmplib/scapi.c during library init. static-php builds OpenSSL with no-legacy, so the provider is intentionally absent; the warning lands on stderr and breaks the PHP CLI smoke test in CI. Drop the warning while keeping the provider load fallback. --- src/Package/Library/net_snmp.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Package/Library/net_snmp.php b/src/Package/Library/net_snmp.php index cb7b2aaea..e1c0ff305 100644 --- a/src/Package/Library/net_snmp.php +++ b/src/Package/Library/net_snmp.php @@ -24,6 +24,20 @@ public function patchBeforeBuild(LibraryPackage $lib): void FileSystem::replaceFileStr("{$lib->getSourceDir()}/configure", 'LIBS="-lssl ${OPENSSL_LIBS}"', 'LIBS="-lssl ${OPENSSL_LIBS} -lpthread -ldl"'); } + #[PatchBeforeBuild] + #[PatchDescription('Silence expected missing OpenSSL legacy provider warning')] + public function patchLegacyProviderWarning(LibraryPackage $lib): void + { + // net-snmp 5.10 logs a warning at library init when the legacy provider is + // unavailable. static-php builds OpenSSL with no-legacy, so the provider is + // intentionally absent and the warning breaks CLI smoke tests. + FileSystem::replaceFileStr( + "{$lib->getSourceDir()}/snmplib/scapi.c", + " if (legacy_provider == NULL)\n snmp_log(LOG_WARNING, \"Failed to load OpenSSL legacy provider\\n\");", + ' /* static-php builds OpenSSL with no-legacy: a missing legacy provider is expected */' + ); + } + #[BuildFor('Darwin')] #[BuildFor('Linux')] public function buildUnix(LibraryPackage $lib): void