mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
Merge branch 'next-minor' into next-major
This commit is contained in:
@@ -69,6 +69,7 @@ use function mb_check_encoding;
|
||||
use function ob_end_clean;
|
||||
use function ob_get_contents;
|
||||
use function ob_start;
|
||||
use function opcache_get_status;
|
||||
use function ord;
|
||||
use function php_uname;
|
||||
use function phpversion;
|
||||
@@ -486,8 +487,8 @@ final class Utils{
|
||||
*/
|
||||
public static function currentTrace(int $skipFrames = 0) : array{
|
||||
++$skipFrames; //omit this frame from trace, in addition to other skipped frames
|
||||
if(function_exists("xdebug_get_function_stack")){
|
||||
$trace = array_reverse(xdebug_get_function_stack());
|
||||
if(function_exists("xdebug_get_function_stack") && count($trace = @xdebug_get_function_stack()) !== 0){
|
||||
$trace = array_reverse($trace);
|
||||
}else{
|
||||
$e = new \Exception();
|
||||
$trace = $e->getTrace();
|
||||
@@ -634,4 +635,30 @@ final class Utils{
|
||||
public static function checkLocationNotInfOrNaN(Location $location) : void{
|
||||
self::checkVector3NotInfOrNaN($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an integer describing the current OPcache JIT setting.
|
||||
* @see https://www.php.net/manual/en/opcache.configuration.php#ini.opcache.jit
|
||||
*/
|
||||
public static function getOpcacheJitMode() : ?int{
|
||||
if(
|
||||
function_exists('opcache_get_status') &&
|
||||
($opcacheStatus = opcache_get_status(false)) !== false &&
|
||||
isset($opcacheStatus["jit"]["on"])
|
||||
){
|
||||
$jit = $opcacheStatus["jit"];
|
||||
if($jit["on"] === true){
|
||||
return (($jit["opt_flags"] >> 2) * 1000) +
|
||||
(($jit["opt_flags"] & 0x03) * 100) +
|
||||
($jit["kind"] * 10) +
|
||||
$jit["opt_level"];
|
||||
}
|
||||
|
||||
//jit available, but disabled
|
||||
return 0;
|
||||
}
|
||||
|
||||
//jit not available
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user