Fix My Computer, Mark! - Warning: Parameter 2 to frontpage() expected to be a reference 

Warning: Parameter 2 to frontpage() expected to be a reference

I have Mambo 4.6.1 Stable and upgraded from PHP 5.3 to PHP 5.6 and got this error:

Warning: Parameter 2 to frontpage() expected to be a reference, value given in C:\xampp\htdocs\mambo\includes\Cache\Lite\Function.php on line 100

Here is how I fixed it!

Open: /includes/Cache/Lite/Function.php

(this solves the "Reference instead of value"-problem)

Copy and Paste the code below and replacing the code in your Function.php file: 

<?php

/**
* This class extends Cache_Lite and can be used to cache the result and output of functions/methods
*
* This class is completly inspired from Sebastian Bergmann's
* PEAR/Cache_Function class. This is only an adaptation to
* Cache_Lite
*
* There are some examples in the 'docs/examples' file
* Technical choices are described in the 'docs/technical' file
*
* @package Cache_Lite
* @version $Id: Function.php 49 2005-09-15 02:55:27Z rhuk $
* @author Sebastian BERGMANN <This email address is being protected from spambots. You need JavaScript enabled to view it.>
* @author Fabien MARTY <This email address is being protected from spambots. You need JavaScript enabled to view it.>
*/

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

require_once( $mosConfig_absolute_path . '/includes/Cache/Lite.php' );

class Cache_Lite_Function extends Cache_Lite
{

	// --- Private properties ---

	/**
	* Default cache group for function caching
	*
	* @var string $_defaultGroup
	*/
	var $_defaultGroup = 'Cache_Lite_Function';

	// --- Public methods ----

	/**
	* Constructor
	*
	* $options is an assoc. To have a look at availables options,
	* see the constructor of the Cache_Lite class in 'Cache_Lite.php'
	*
	* Comparing to Cache_Lite constructor, there is another option :
	* $options = array(
	*	 (...) see Cache_Lite constructor
	*	 'defaultGroup' => default cache group for function caching (string)
	* );
	*
	* @param array $options options
	* @access public
	*/
	function Cache_Lite_Function($options = array(NULL))
	{
		if (isset($options['defaultGroup'])) {
			$this->_defaultGroup = $options['defaultGroup'];
		}
		$this->Cache_Lite($options);
	}

	/**
	* Calls a cacheable function or method (or not if there is already a cache for it)
	*
	* Arguments of this method are read with func_get_args. So it doesn't appear
	* in the function definition. Synopsis :
	* call('functionName', $arg1, $arg2, ...)
	* (arg1, arg2... are arguments of 'functionName')
	*
	* @return mixed result of the function/method
	* @access public
	*/
	function call()
	{
		$arguments = func_get_args();
		$id = serialize($arguments); // Generate a cache id
		if (!$this->_fileNameProtection) {
			$id = md5($id);
			// if fileNameProtection is set to false, then the id has to be hashed
			// because it's a very bad file name in most cases
		}
		$data = $this->get($id, $this->_defaultGroup);
		if ($data !== false) {
			$array = unserialize($data);
			$output = $array['output'];
			$result = $array['result'];
		} else {
			ob_start();
			ob_implicit_flush(false);
			$target = array_shift($arguments);
			if (strstr($target, '::')) { // classname::staticMethod
				list($class, $method) = explode('::', $target);
				
				/*
				echo "calling: $target<br />";
				echo "<h1>Arguments before</h1><xmp>";
				print_r($arguments);
				for ($i = 0, $j = count($arguments); $i < $j; $i++ ) {
					if (is_object($arguments[$i])) {
						global $newobjCount;
						if (!$newobjCount) $newobjCount = 0;
						$newobj[++$newobjCount] = clone $arguments[$i];
						
						$arguments[$i] = &$newobj[$newobjCount];
					}
				}
				echo "</xmp><h1>Arguments after</h1><xmp>";
				print_r($arguments);
				echo "</xmp>";
				*/
				
				// added
				$arguments = $this->fixCalls($arguments);
				
				$result = call_user_func_array(array($class, $method), $arguments);
			} else if (strstr($target, '->')) { // object->method
				// use a stupid name ($objet_123456789 because) of problems when the object
				// name is the same as this var name
				list($object_123456789, $method) = explode('->', $target);
				global $$object_123456789;
				$result = call_user_func_array(array($$object_123456789, $method), $arguments);
			} else { // function
				
				// added
				$arguments = $this->fixCalls($arguments);
				
				$result = call_user_func_array($target, $arguments);
				
			}
			$output = ob_get_contents();
			ob_end_clean();
			$array['output'] = $output;
			$array['result'] = $result;
			$this->save(serialize($array), $id, $this->_defaultGroup);
		}
		echo($output);
		return $result;
	}
	
	
	static $newobjCount,$newobj;
    function fixCalls($arguments) {
	    for ($i = 0, $j = count($arguments); $i < $j; $i++) {
	        if (is_object($arguments[$i])) {
	            if (!self::$newobjCount) self::$newobjCount = 0;
	            self::$newobj[++self::$newobjCount] = clone $arguments[$i];
	                
	            $arguments[$i] = &self::$newobj[self::$newobjCount];
	        }
	    }
		
		return $arguments;    
	}

}

?>

 

Open: /includes/vcard.class.php
(to make the contact form work again)

 

Copy and Paste the code below and replacing the code in your vcard.class.php file:

<?php
/**
* @version $Id: vcard.class.php 734 2005-10-31 02:53:15Z stingrey $
* Modified PHP vCard class v2.0
*/

/***************************************************************************
PHP vCard class v2.0
(cKai Blankenhorn
www.bitfolge.de/en
This email address is being protected from spambots. You need JavaScript enabled to view it.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
***************************************************************************/

function encode($string) {
	return escape(quoted_printable_encode($string));
}

function escape($string) {
	return str_replace(';',"\;",$string);
}

// taken from PHP documentation comments
if(!function_exists('quoted_printable_encode'))
{
function quoted_printable_encode($input, $line_max = 76) {
	$hex 		= array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
	$lines 		= preg_split("/(?:\r\n|\r|\n)/", $input);
	$eol 		= "\r\n";
	$linebreak 	= '=0D=0A';
	$escape 	= '=';
	$output 	= '';

	for ($j=0;$j<count($lines);$j++) {
		$line 		= $lines[$j];
		$linlen 	= strlen($line);
		$newline 	= '';
		
		for($i = 0; $i < $linlen; $i++) {
			$c 		= substr($line, $i, 1);
			$dec 	= ord($c);
			
			if ( ($dec == 32) && ($i == ($linlen - 1)) ) { // convert space at eol only
				$c = '=20';
			} elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
				$h2 = floor($dec/16); 
				$h1 = floor($dec%16);
				$c 	= $escape.$hex["$h2"] . $hex["$h1"];
			}
			if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
				$output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
				$newline = "    ";
			}
			$newline .= $c;
		} // end of for
		$output .= $newline;
		if ($j<count($lines)-1) {
			$output .= $linebreak;
		}
	}
	
	return trim($output);
}
}

class vCard {
	var $properties;
	var $filename;

	function setPhoneNumber($number, $type='') {
	// type may be PREF | WORK | HOME | VOICE | FAX | MSG | CELL | PAGER | BBS | CAR | MODEM | ISDN | VIDEO or any senseful combination, e.g. "PREF;WORK;VOICE"
		$key = 'TEL';
		if ($type!='') {
			$key .= ';'. $type;
		}
		$key.= ';ENCODING=QUOTED-PRINTABLE';
		
		$this->properties[$key] = quoted_printable_encode($number);
	}

	// UNTESTED !!!
	function setPhoto($type, $photo) { // $type = "GIF" | "JPEG"
		$this->properties["PHOTO;TYPE=$type;ENCODING=BASE64"] = base64_encode($photo);
	}

	function setFormattedName($name) {
		$this->properties['FN'] = quoted_printable_encode($name);
	}

	function setName($family='', $first='', $additional='', $prefix='', $suffix='') {
		$this->properties['N'] = "$family;$first;$additional;$prefix;$suffix";
		$this->filename = "$first%20$family.vcf";
		if ($this->properties['FN']=='') {
			$this->setFormattedName(trim("$prefix $first $additional $family $suffix"));
		}
	}

	function setBirthday($date) { // $date format is YYYY-MM-DD
		$this->properties['BDAY'] = $date;
	}

	function setAddress($postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL') {
	// $type may be DOM | INTL | POSTAL | PARCEL | HOME | WORK or any combination of these: e.g. "WORK;PARCEL;POSTAL"
		$key = 'ADR';
		if ($type!='') {
			$key.= ";$type";
		}
		
		$key.= ';ENCODING=QUOTED-PRINTABLE';
		$this->properties[$key] = encode($name).';'.encode($extended).';'.encode($street).';'.encode($city).';'.encode($region).';'.encode($zip).';'.encode($country);

		if ($this->properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] == '') {
			//$this->setLabel($postoffice, $extended, $street, $city, $region, $zip, $country, $type);
		}
	}

	function setLabel($postoffice='', $extended='', $street='', $city='', $region='', $zip='', $country='', $type='HOME;POSTAL') {
		$label = '';
		if ($postoffice!='') {
			$label.= $postoffice;
			$label.= "\r\n";
		}
		
		if ($extended!='') {
			$label.= $extended;
			$label.= "\r\n";
		}
		
		if ($street!='') {
			$label.= $street;
			$label.= "\r\n";
		}
		
		if ($zip!='') {
			$label.= $zip .' ';
		}
		
		if ($city!='') {
			$label.= $city;
			$label.= "\r\n";
		}
		
		if ($region!='') {
			$label.= $region;
			$label.= "\r\n";
		}
		
		if ($country!='') {
			$country.= $country;
			$label.= "\r\n";
		}

		$this->properties["LABEL;$type;ENCODING=QUOTED-PRINTABLE"] = quoted_printable_encode($label);
	}

	function setEmail($address) {
		$this->properties['EMAIL;INTERNET'] = $address;
	}

	function setNote($note) {
		$this->properties['NOTE;ENCODING=QUOTED-PRINTABLE'] = quoted_printable_encode($note);
	}

	function setURL($url, $type='') {
	// $type may be WORK | HOME
		$key = 'URL';
		if ($type!='') {
			$key.= ";$type";
		}
		
		$this->properties[$key] = $url;
	}

	function getVCard() {
		$text = 'BEGIN:VCARD';
		$text.= "\r\n";
		$text.= 'VERSION:2.1';
		$text.= "\r\n";

		foreach($this->properties as $key => $value) {
			$text.= "$key:$value\r\n";
		}
		
		$text.= 'REV:'. date('Y-m-d') .'T'. date('H:i:s') .'Z';
		$text.= "\r\n";
		$text.= 'MAILER:PHP vCard class by Kai Blankenhorn';
		$text.= "\r\n";
		$text.= 'END:VCARD';
		$text.= "\r\n";

		return $text;
	}

	function getFileName() {
		return $this->filename;
	}
}
?>

 

Or you can download the updated files here:

http://www.fixmycomputermark.com/free-downloads/file/50-fix_joomla_10x_php_530.html

 

Click to listen highlighted text!