Skip to content

Commit

Permalink
Merge pull request #4269 from Deltik/php-8-compatibility
Browse files Browse the repository at this point in the history
PHP 8.0 compatibility
  • Loading branch information
CaMer0n authored Dec 2, 2020
2 parents 0114aa2 + 28ae487 commit ce30a09
Show file tree
Hide file tree
Showing 76 changed files with 6,106 additions and 1,899 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,23 @@ jobs:
matrix:
interpreter:
- image: php:5.6
- image: php:7.0
- image: php:7.1
- image: php:7.2
- image: php:7.3
- image: php:7.4
- image: php:8.0-rc
db:
- image: mysql:5.5
- image: mysql:5.6
- image: mysql:5.7
- image: bitnami/mysql:8.0
- image: mariadb:10.0
- image: mariadb:10.1
- image: mariadb:10.2
- image: mariadb:10.3
- image: mariadb:10.4
- image: mariadb:10.5
runs-on: ubuntu-latest
container:
image: ${{ matrix.interpreter.image }}
Expand All @@ -35,6 +43,7 @@ jobs:
env:
MYSQL_ROOT_PASSWORD: 'Database Password for Continuous Integration'
MYSQL_DATABASE: 'app'
MYSQL_AUTHENTICATION_PLUGIN: 'mysql_native_password'
options: >-
--health-cmd "mysqladmin ping"
--health-interval 10s
Expand Down Expand Up @@ -77,9 +86,12 @@ jobs:
if [ $(php -r 'printf(version_compare(PHP_VERSION, "7.2.0", ">=") ? 1 : 0);') = '1' ]
then
pecl install xdebug
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "7.0.0", ">=") ? 1 : 0);') = '1' ]
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "7.1.0", ">=") ? 1 : 0);') = '1' ]
then
pecl install xdebug-2.9.8
elif [ $(php -r 'printf(version_compare(PHP_VERSION, "7.0.0", ">=") ? 1 : 0);') = '1' ]
then
pecl install xdebug-2.7.2
else
pecl install xdebug-2.5.5
fi
Expand All @@ -91,7 +103,7 @@ jobs:
run: curl -sSL https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin/ --filename=composer

- name: Install dependencies
run: composer install --prefer-dist --no-progress
run: composer update --prefer-dist --no-progress
working-directory: ./e107_tests/

- name: Download Git submodule dependencies
Expand Down
4 changes: 2 additions & 2 deletions class2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2552,10 +2552,10 @@ private function deftrue($value)
* @param $message
* @param $file
* @param $line
* @param $context
* @param $context (deprecated since PHP 7.2.0)
* @return bool
*/
function handle_error($type, $message, $file, $line, $context) {
function handle_error($type, $message, $file, $line, $context = null) {
$startup_error = (!defined('E107_DEBUG_LEVEL')); // Error before debug system initialized


Expand Down
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@
"platform": {
"php": "5.6"
},
"vendor-dir": "e107_handlers/vendor"
"vendor-dir": "e107_handlers/vendor",
"platform-check": false
},
"require": {
"php": ">=5.6",
"ext-json": "*",
"ext-pdo": "*",
"hybridauth/hybridauth": "^3.1.1",
"phpmailer/phpmailer": "^6.1",
"tedivm/jshrink": "^1.3",
"ifsnop/mysqldump-php": "^2.8"
"ifsnop/mysqldump-php": "^2.8",
"matthiasmullie/minify": "^1.3"
},
"require-dev": {}
}
167 changes: 119 additions & 48 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions e107_admin/lancheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ function check_lan_errors($english,$translation,$def, $opts=array())



function checkLog($type='error',$count)
function checkLog($type='error',$count=1)
{
$lan = $this->transLanguage;
$_SESSION['lancheck'][$lan][$type] += $count;
Expand Down Expand Up @@ -1602,9 +1602,9 @@ function get_comp_lan_phrases($comp_dir,$lang,$depth=0)


// for plugins and themes - checkes what kind of language files directory structure we have
function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan)
function check_lanfiles($mode,$comp_name,$base_lan="English",$target_lan=null)
{

if (empty($target_lan)) throw new RuntimeException(__METHOD__ . ' requires non-empty $target_lan');

$tp = e107::getParser();

Expand Down
2 changes: 1 addition & 1 deletion e107_core/bbcodes/time.bb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
$class = e107::getBB()->getClass('time');

include_once(e_HANDLER."date_handler.php");
return "<span class='{$class}'>".convert::convert_date($code_text, $parm)."</span>";
return "<span class='{$class}'>".e107::getDate()->convert_date($code_text, $parm)."</span>";
2 changes: 1 addition & 1 deletion e107_core/shortcodes/batch/bbcode_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function bb_format($id)
);


if(BOOTSTRAP)
if(defined('BOOTSTRAP') && BOOTSTRAP)
{
$text = '<div class="btn-group">';
$text .= '<a class="btn btn-default btn-secondary dropdown-toggle" data-toggle="dropdown" href="#" title="">';
Expand Down
12 changes: 4 additions & 8 deletions e107_core/shortcodes/batch/news_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ function sc_trackback($parm=null)
*/
function sc_newsnavlink($parm=null) //TODO add more options.
{

$url = e107::getUrl()->create('news/list/items'); // default for now.

if(varset($parm['list']) == 'all') // A list of all items - usually headings and thumbnails
{
$url = e107::getUrl()->create('news/list/all');
Expand All @@ -215,19 +216,14 @@ function sc_newsnavlink($parm=null) //TODO add more options.
{
$url = e107::getUrl()->create('news/list/category', $this->news_item);
}
else
{
$url = e107::getUrl()->create('news/list/items'); // default for now.
}



$caption = vartrue($parm['text'],LAN_BACK);

$text = '<ul class="pager hidden-print">
<li><a href="'.$url.'">'.e107::getParser()->toHTML($caption,false,'defs').'</a></li>
</ul>';

if(BOOTSTRAP === 4)
if(defined('BOOTSTRAP') && BOOTSTRAP === 4)
{
$text = '<a class="pager-button btn btn-primary hidden-print" href="'.$url.'">'.e107::getParser()->toHTML($caption,false,'defs').'</a>';
}
Expand Down
2 changes: 1 addition & 1 deletion e107_core/shortcodes/batch/page_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function cpagecomments()

if(e107::getPref('comments_disabled') == 0 && !$comflag)
{
if(BOOTSTRAP)
if(defined('BOOTSTRAP') && BOOTSTRAP)
{
return e107::getMessage()->addInfo(LAN_PAGE_17)->render();
}
Expand Down
4 changes: 3 additions & 1 deletion e107_core/shortcodes/batch/user_shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class user_shortcodes extends e_shortcode

function __construct()
{
parent::__construct();

$pref = e107::getPref();

$this->commentsDisabled = vartrue($pref['comments_disabled']);
Expand Down Expand Up @@ -797,7 +799,7 @@ function sc_user_extended_all($parm)
$extended_record = str_replace("EXTENDED_VALUE","USER_EXTENDED={$key}.value.{$this->var['user_id']}", $extended_record);
$extended_record = str_replace('{EXTENDED_ID}',$frm->name2id('user_'.$key), $extended_record);

if(HIDE_EMPTY_FIELDS === TRUE)
if(defined('HIDE_EMPTY_FIELDS') && HIDE_EMPTY_FIELDS === TRUE)
{
$this_value = $tp->parseTemplate("{USER_EXTENDED={$key}.value.{$this->var['user_id']}}", TRUE);

Expand Down
Loading

0 comments on commit ce30a09

Please sign in to comment.