mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-08 17:35:36 +08:00
Fix several patches & newer phpmicro support (#470)
* use upstream phpmicro * move src/global/tests to src/global/ext-tests * move src/global/tests to src/global/ext-tests * prevent file_get_contents memory insufficience * update README * fix libxml >= 2.12 with older PHP (<=8.1) build bug * cleanup code, support newer phpmicro * add --no-strip and --with-upx-pack tests * fix windows sanity check for newer phpmicro * fix windows sanity check for newer phpmicro * test * test * test * update deps for ci
This commit is contained in:
5
src/globals/ext-tests/bcmath.php
Normal file
5
src/globals/ext-tests/bcmath.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('bcscale'));
|
||||
8
src/globals/ext-tests/bz2.php
Normal file
8
src/globals/ext-tests/bz2.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$str = 'This is bz2 extension test';
|
||||
assert(function_exists('bzdecompress'));
|
||||
assert(function_exists('bzcompress'));
|
||||
assert(bzdecompress(bzcompress($str, 9)) === $str);
|
||||
6
src/globals/ext-tests/calendar.php
Normal file
6
src/globals/ext-tests/calendar.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('cal_info'));
|
||||
assert(is_array(cal_info(0)));
|
||||
5
src/globals/ext-tests/curl.php
Normal file
5
src/globals/ext-tests/curl.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('curl_init'));
|
||||
8
src/globals/ext-tests/dom.php
Normal file
8
src/globals/ext-tests/dom.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(class_exists('\\DOMDocument'));
|
||||
$doc = new DOMDocument();
|
||||
$doc->loadHtml('<html><head><meta charset="UTF-8"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body id="app">Hello</body></html>');
|
||||
assert($doc->getElementById('app')->nodeValue === 'Hello');
|
||||
5
src/globals/ext-tests/filter.php
Normal file
5
src/globals/ext-tests/filter.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('filter_var'));
|
||||
9
src/globals/ext-tests/gd.php
Normal file
9
src/globals/ext-tests/gd.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('gd_info'));
|
||||
$info = gd_info();
|
||||
assert($info['PNG Support'] ?? false);
|
||||
assert($info['GIF Create Support'] ?? false);
|
||||
assert($info['GIF Read Support'] ?? false);
|
||||
25
src/globals/ext-tests/gettext.php
Normal file
25
src/globals/ext-tests/gettext.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('gettext'));
|
||||
assert(function_exists('bindtextdomain'));
|
||||
assert(function_exists('textdomain'));
|
||||
assert(function_exists('bind_textdomain_codeset'));
|
||||
|
||||
if (!is_dir('locale/en_US/LC_MESSAGES/')) {
|
||||
mkdir('locale/en_US/LC_MESSAGES/', 0755, true);
|
||||
}
|
||||
if (!file_exists('locale/en_US/LC_MESSAGES/test.mo')) {
|
||||
$mo = '3hIElQAAAAACAAAAHAAAACwAAAAFAAAAPAAAAAAAAABQAAAABgAAAFEAAAAXAQAAWAAAAAcAAABwAQAAAQAAAAAAAAAAAAAAAgAAAAAAAAAA56S65L6LAFByb2plY3QtSWQtVmVyc2lvbjogUEFDS0FHRSBWRVJTSU9OClJlcG9ydC1Nc2dpZC1CdWdzLVRvOiAKUE8tUmV2aXNpb24tRGF0ZTogWUVBUi1NTy1EQSBITzpNSStaT05FCkxhc3QtVHJhbnNsYXRvcjogRlVMTCBOQU1FIDxFTUFJTEBBRERSRVNTPgpMYW5ndWFnZS1UZWFtOiBMQU5HVUFHRSA8TExAbGkub3JnPgpMYW5ndWFnZTogCk1JTUUtVmVyc2lvbjogMS4wCkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD1VVEYtOApDb250ZW50LVRyYW5zZmVyLUVuY29kaW5nOiA4Yml0CgBFeGFtcGxlAA==';
|
||||
file_put_contents('locale/en_US/LC_MESSAGES/test.mo', base64_decode($mo));
|
||||
}
|
||||
putenv('LANG=en_US');
|
||||
setlocale(LC_ALL, 'en_US');
|
||||
|
||||
$domain = 'test';
|
||||
bindtextdomain($domain, 'locale/');
|
||||
bind_textdomain_codeset($domain, 'UTF-8');
|
||||
textdomain($domain);
|
||||
|
||||
assert(gettext(json_decode('"\u793a\u4f8b"', true)) === 'Example');
|
||||
5
src/globals/ext-tests/intl.php
Normal file
5
src/globals/ext-tests/intl.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(class_exists(NumberFormatter::class));
|
||||
6
src/globals/ext-tests/openssl.php
Normal file
6
src/globals/ext-tests/openssl.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('openssl_digest'));
|
||||
assert(openssl_digest('123456', 'md5') === 'e10adc3949ba59abbe56e057f20f883e');
|
||||
5
src/globals/ext-tests/parallel.php
Normal file
5
src/globals/ext-tests/parallel.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(class_exists('\parallel\Runtime'));
|
||||
5
src/globals/ext-tests/redis.php
Normal file
5
src/globals/ext-tests/redis.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(class_exists('\\Redis'));
|
||||
12
src/globals/ext-tests/swoole.php
Normal file
12
src/globals/ext-tests/swoole.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('swoole_cpu_num'));
|
||||
assert(function_exists('swoole_string'));
|
||||
assert(class_exists('Swoole\Coroutine'));
|
||||
assert(class_exists('Swoole\Coroutine\Http2\Client'));
|
||||
assert(class_exists('Swoole\Coroutine\Redis'));
|
||||
assert(class_exists('Swoole\Coroutine\WaitGroup'));
|
||||
assert(class_exists('Swoole\Http2\Request'));
|
||||
assert(constant('SWOOLE_VERSION'));
|
||||
6
src/globals/ext-tests/uuid.php
Normal file
6
src/globals/ext-tests/uuid.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('uuid_create'));
|
||||
assert(strlen(uuid_create(0)) === 36);
|
||||
5
src/globals/ext-tests/zip.php
Normal file
5
src/globals/ext-tests/zip.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(class_exists('\\ZipArchive'));
|
||||
6
src/globals/ext-tests/zlib.php
Normal file
6
src/globals/ext-tests/zlib.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
assert(function_exists('gzcompress'));
|
||||
assert(gzdecode(gzencode('aaa')) === 'aaa');
|
||||
Reference in New Issue
Block a user