Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 does not work with Kodexplorer #458

Closed
batata004 opened this issue Dec 1, 2020 · 3 comments · Fixed by #467
Closed

PHP 8 does not work with Kodexplorer #458

batata004 opened this issue Dec 1, 2020 · 3 comments · Fixed by #467

Comments

@batata004
Copy link

hi,

Kodexplorer is awesome however the latest PHP version (8.0) does not work with it. Dozens of errors that I tried fixing manually but everytime I fixed something, another came up.

Any idea if there will be a version of kodexplorer that supports PHP 8?

@Lucilor
Copy link

Lucilor commented Dec 23, 2020

In my case, add error_reporting(0); in "config/config.php" works.

@spirit1431007
Copy link

Modify theses files, replace match to matching

/app/function/common.function.php
/app/function/helper.function.php
/app/sdks/lessc.class.php
/app/controller/app.class.php

modify function msubstr in /app/function/common.function.php file, change it like this ( just modify $length = 0 ) :

function msubstr($str, $start = 0, $length = 0, $charset = "utf-8", $suffix = true){
	if (function_exists("mb_substr")) {
		$i_str_len = mb_strlen($str);
		$s_sub_str = mb_substr($str, $start, $length, $charset);
		if ($length >= $i_str_len) {
			return $s_sub_str;
		} 
		return $s_sub_str . '...';
	} elseif (function_exists('iconv_substr')) {
		return iconv_substr($str, $start, $length, $charset);
	} 
	$re['utf-8'] = "/[\x01-\x7f]|[\xc2-\xdf][\x80-\xbf]|[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xff][\x80-\xbf]{3}/";
	$re['gb2312'] = "/[\x01-\x7f]|[\xb0-\xf7][\xa0-\xfe]/";
	$re['gbk'] = "/[\x01-\x7f]|[\x81-\xfe][\x40-\xfe]/";
	$re['big5'] = "/[\x01-\x7f]|[\x81-\xfe]([\x40-\x7e]|\xa1-\xfe])/";
	preg_match_all($re[$charset], $str, $match);
	$slice = join("", array_slice($match[0], $start, $length));
	if ($suffix) return $slice . "…";
	return $slice;
}

@stasink
Copy link

stasink commented Mar 12, 2021

And do not forget to replace the curly braces with square brackets on line 1031
$pad = ord($text[strlen($text)-1]);

@ghost ghost mentioned this issue Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants