CMS MADE SIMPLE FORGE

CMS Made Simple Core

 

[#12540] Module MicroTiny 2.2.5 corrections + compatible php 7.1.0 to 8.1.4

avatar
Created By: Philippe Thomas (filto)
Date Submitted: Mon Apr 18 22:16:45 -0400 2022

Assigned To:
Version: None
CMSMS Version: 2.2.16
Severity: Major
Resolution: Fixed
State: Closed
Summary:
Module MicroTiny 2.2.5 corrections + compatible php 7.1.0 to 8.1.4
Detailed Description:
------------------------------------------------------------------------------
modules/MicroTiny/lib/class.microtiny_utils.php

L177 function _generate_config

return $tpl_ob->fetch();
return $result;

#---- remove last return

return $tpl_ob->fetch();

----------------------

##########
#-- make compatibility PHP versions from php 7.1.0 to 8.x.x : prevent compatible
notice

------------------------------------------------------------------------------
modules/MicroTiny/lib/class.microtiny_profile.php


L 19 :  public function OffsetGet($key)

#-- correction : type output must be :mixed, but not defined in php 7.x, so
temporarily suppress the notice

#[\ReturnTypeWillChange]
public function OffsetGet($key)

#--L45  mixed type must return a value: so  at the end of this function add :
return null if no case match OR $key is not set

default:
throw new CmsInvalidDataException('invalid key '.$key.' for '.__CLASS__.'
object');
    }
  }
#-- correction
  
  default:
throw new CmsInvalidDataException('invalid key '.$key.' for '.__CLASS__.'
object');
    }
  return null;
}

-----
L 50 

public function OffsetSet($key,$value)
#-- correction
public function OffsetSet($key,$value):void

L79
public function OffsetExists($key)
#-- correction
public function OffsetExists($key):bool

L95
  default:
throw new CmsInvalidDataException('invalid key '.$key.' for '.__CLASS__.'
object');
    }
  }
#-- correction 
  default:
throw new CmsInvalidDataException('invalid key '.$key.' for '.__CLASS__.'
object');
    }
  return false;
  }

L100
 public function OffsetUnset($key)
#-- correction 
public function OffsetUnset($key):void


History

Comments
avatar
Date: 2022-09-21 21:38
Posted By: tom (tomphantoo)

2.2.16 is not PHP7+ syntax, so no return-type declarations.
#[\ReturnTypeWillChange] is ok, of course
      
Updates

Updated: 2022-09-21 21:38
resolution_id: => 7
state: Open => Closed