diff options
-rw-r--r-- | preload-foo.inc | 1 | ||||
-rw-r--r-- | preload-zstd.inc | 2 | ||||
-rw-r--r-- | preload.php | 3 | ||||
-rw-r--r-- | zstd.php | 6 |
4 files changed, 6 insertions, 6 deletions
diff --git a/preload-foo.inc b/preload-foo.inc index 31be7d6..af509e2 100644 --- a/preload-foo.inc +++ b/preload-foo.inc @@ -2,5 +2,6 @@ namespace Remi; class Foo { + static private $single = NULL; } diff --git a/preload-zstd.inc b/preload-zstd.inc index de8abd0..f56c833 100644 --- a/preload-zstd.inc +++ b/preload-zstd.inc @@ -19,10 +19,12 @@ class Zstd { // Try if preloaded try { self::$ffi = \FFI::scope("_REMI_ZSTD_"); + echo "Using FFI::scope OK\n"; } catch (\FFI\Exception $e) { // Try direct load if (PHP_SAPI === 'cli' || (int)ini_get("ffi.enable")) { self::$ffi = \FFI::load(__DIR__ . '/preload-zstd.h'); + echo "Using FFI::load OK\n"; } else { throw $e; } diff --git a/preload.php b/preload.php index 1af70d6..d442e15 100644 --- a/preload.php +++ b/preload.php @@ -1,7 +1,4 @@ <?php -foreach (glob(__DIR__ . '/preload-*.h') as $f) { - \FFI::load($f); -} foreach (glob(__DIR__ . '/preload-*.inc') as $f) { opcache_compile_file($f); } @@ -14,16 +14,16 @@ if (PHP_VERSION_ID < 70400 || !extension_loaded("ffi")) { printf("PHP version %s\n", PHP_VERSION); if (PHP_SAPI == "cli" && !class_exists("\\Remi\\Zstd")) { - printf("Fallback on manual load\n\n"); + printf("Fallback on manual load\n"); require_once __DIR__ . '/preload-zstd.inc'; } else { - printf("Use preloaded class\n\n"); + printf("Use preloaded class\n"); } if (class_exists("\\Remi\\Zstd")) { $t = microtime(true); $ret = \Remi\Zstd::compress(PHP_BINARY, "testffi.zstd"); - printf("Src length = %d\n", $ret['in_len']); + printf("\nSrc length = %d\n", $ret['in_len']); printf("ZSTD_compressBound = %d\n", $ret['max_len']); printf("ZSTD_compress = %d\n", $ret['out_len']); |