Skip to content

Commit c6d4934

Browse files
authored
Fix gmssl and openssl duplicate symbol (#632)
* Fix gmssl and openssl duplicate symbol * Add tests
1 parent 21265cd commit c6d4934

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

config/source.json

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@
261261
"gmssl": {
262262
"type": "ghtar",
263263
"repo": "guanzhi/GmSSL",
264+
"provide-pre-built": true,
264265
"license": {
265266
"type": "file",
266267
"path": "LICENSE"

src/SPC/store/SourcePatcher.php

+7
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public static function init(): void
3030
FileSystem::addSourceExtractHook('ext-imagick', [SourcePatcher::class, 'patchImagickWith84']);
3131
FileSystem::addSourceExtractHook('libaom', [SourcePatcher::class, 'patchLibaomForAlpine']);
3232
FileSystem::addSourceExtractHook('attr', [SourcePatcher::class, 'patchAttrForAlpine']);
33+
FileSystem::addSourceExtractHook('gmssl', [SourcePatcher::class, 'patchGMSSL']);
3334
}
3435

3536
/**
@@ -541,4 +542,10 @@ public static function unpatchMicroWin32(): void
541542
rename(SOURCE_PATH . '\php-src\sapi\micro\php_micro.c.win32bak', SOURCE_PATH . '\php-src\sapi\micro\php_micro.c');
542543
}
543544
}
545+
546+
public static function patchGMSSL(): void
547+
{
548+
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)');
549+
FileSystem::replaceFileStr(SOURCE_PATH . '/gmssl/src/hex.c', 'OPENSSL_hexchar2int', 'GMSSL_hexchar2int');
550+
}
544551
}

src/globals/test-extensions.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
];
2929

3030
// whether enable thread safe
31-
$zts = true;
31+
$zts = false;
3232

3333
$no_strip = false;
3434

@@ -40,7 +40,7 @@
4040

4141
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
4242
$extensions = match (PHP_OS_FAMILY) {
43-
'Linux', 'Darwin' => 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,ftp,gd,gmp,gettext,iconv,igbinary,imagick,intl,ldap,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,parallel,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,ssh2,sysvmsg,sysvsem,sysvshm,tidy,tokenizer,xlswriter,xml,xmlreader,xmlwriter,zip,zlib,yaml,zstd',
43+
'Linux', 'Darwin' => 'openssl,gmssl',
4444
'Windows' => 'gettext',
4545
};
4646

0 commit comments

Comments
 (0)