diff --git a/src/FFIExtend.php b/src/FFIExtend.php index f28809e..264eb1f 100644 --- a/src/FFIExtend.php +++ b/src/FFIExtend.php @@ -61,6 +61,7 @@ class FFIExtend public function __construct() { + defined('PHP_DLL_FILE_PATH') || define('PHP_DLL_FILE_PATH', false); if(self::$ffi === null) { $this->versionMacro(); $this->initPhpApi(); @@ -136,7 +137,7 @@ private function initPhpApi() self::$ffi = FFI::cdef($code, $phpDll); } else { $code = str_replace('ZEND_FASTCALL', '__attribute__((fastcall))', $code); - if(defined('PHP_DLL_FILE_PATH')) { + if(PHP_DLL_FILE_PATH) { self::$ffi = FFI::cdef($code, PHP_DLL_FILE_PATH); } else { self::$ffi = FFI::cdef($code); @@ -148,7 +149,7 @@ private function initPhpApi() protected function findPhpDll() { - if(defined('PHP_DLL_FILE_PATH')) { + if(PHP_DLL_FILE_PATH) { return PHP_DLL_FILE_PATH; } $f = '/php7' . (PHP_ZTS ? 'ts' : '') . '.dll'; diff --git a/src/ReflectionCFunction.php b/src/ReflectionCFunction.php index 4a1f2c1..08838bc 100644 --- a/src/ReflectionCFunction.php +++ b/src/ReflectionCFunction.php @@ -21,12 +21,14 @@ class ReflectionCFunction extends FFIExtend implements Reflector private $name = ''; private $ffi = null; private $type = null; + private static $preName; public function __construct(FFI $ffi, $name) { parent::__construct(); $this->ffi = $ffi; $this->name = $name; + self::$preName = $name; $sym = $this->findSymobl($ffi, $name, self::ZEND_FFI_SYM_FUNC); if(!$this->isNull($sym)) { $this->type = $this->ZEND_FFI_TYPE($sym[0]->type)[0]; @@ -42,7 +44,7 @@ public function getName() public static function export() { - return $this->name; + return self::$preName; } public function getClosure()