Fix gmssl and openssl duplicate symbol (#632)

* Fix gmssl and openssl duplicate symbol

* Add tests
This commit is contained in:
Jerry Ma
2025-03-13 14:18:27 +08:00
committed by GitHub
parent 21265cd561
commit c6d4934dd6
3 changed files with 10 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ class SourcePatcher
FileSystem::addSourceExtractHook('ext-imagick', [SourcePatcher::class, 'patchImagickWith84']);
FileSystem::addSourceExtractHook('libaom', [SourcePatcher::class, 'patchLibaomForAlpine']);
FileSystem::addSourceExtractHook('attr', [SourcePatcher::class, 'patchAttrForAlpine']);
FileSystem::addSourceExtractHook('gmssl', [SourcePatcher::class, 'patchGMSSL']);
}
/**
@@ -541,4 +542,10 @@ class SourcePatcher
rename(SOURCE_PATH . '\php-src\sapi\micro\php_micro.c.win32bak', SOURCE_PATH . '\php-src\sapi\micro\php_micro.c');
}
}
public static function patchGMSSL(): void
{
FileSystem::replaceFileStr(SOURCE_PATH . '/gmssl/src/hex.c', 'unsigned char *OPENSSL_hexstr2buf(const char *str, size_t *len)', 'unsigned char *GMSSL_hexstr2buf(const char *str, size_t *len)');
FileSystem::replaceFileStr(SOURCE_PATH . '/gmssl/src/hex.c', 'OPENSSL_hexchar2int', 'GMSSL_hexchar2int');
}
}