-1

I'm getting the following error after updating to php 8.2 :

Deprecated in php 8.2 Optional parameter $mode declared before required parameter $name is implicitly treated as a required parameter..

/* 
 * function getHEAD has 3 modes:
 *  META = get META tags for current content level
 *  override = override for current content level (used for override maintenance)
 *  generated = exclude override for current content level (for override maintenance) 
 */
    function getHEAD($mode='META', $name) { //deprecated in php 8.2
        global $db, $prefix, $dhTitle, $dhDesc, $dhKeys, $seocatid, $seosubcatid, $sitename, $slogan;
        $this->setModuleName($name);
        $dhTitle = $dhDesc = $dhKeys = '';
        $contentTDK = $catTDK = array();
        $id = intval($this->getContentID());
        $catidfld = $this->cat_id;
        $seocatid = intval($this->getCatID());
        $subcatidfld = $this->subcat_id;
        $seosubcatid = intval($this->getSubCatID());
        if ($seocatid ==0 and $seosubcatid > 0 and $this->dh_bLinkCatSubcat) $seocatid = $this->getCatIDfromSubcat();
        $level = $this->getContentLevel();

I tried to do

   function getHEAD($mode='META=null, $name) {//NO LUCKY
Vahid2023
  • 863
  • 3
  • 11
  • 33

1 Answers1

-1

In new versions of PHP you should put optional parameters of function at the end , So in your case your code should be like this:

function getHEAD($name , $mode='META') 
{
// the rest

PS : Since PHP 8.0, you can use named arguments ...

Vahid2023
  • 863
  • 3
  • 11
  • 33