Post by fido-x » Fri Feb 06, 2009 10:11 am

I got the following error in Opera:--
Notice: Undefined variable: gzdata in system/library/response.php on line 50
The relevant line of code reads --

Code: Select all

$gzdata .= gzencode($data, (int)$level);
Changing this to --

Code: Select all

$gzdata = gzencode($data, (int)$level);
resolves this error.

However, the biggest issue is character display. See attached screenshot.

Attachments

???
opera.jpg
Last edited by fido-x on Fri Feb 06, 2009 10:13 am, edited 1 time in total.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by bthirsk » Fri Feb 06, 2009 10:44 am

Fido
In \catalog\view\template\module/layout.tpl

swap line 1 with line 3
I think that will cure the rendering problem.

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by gaudi » Fri Feb 06, 2009 7:23 pm

I encounter the same problem. I manage to resolve the $gzdata error using Fido instructions.

I also changed the layout.tpl template. The correct code I presumed should look like this:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="<?php echo $direction; ?>" lang="<?php echo $language; ?>" xml:lang="<?php echo $language; ?>">
<?php echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n"; ?>
<head>
But the strange characters are still there.

Newbie

Posts

Joined
Thu Feb 05, 2009 6:53 pm

Post by JNeuhoff » Fri Feb 06, 2009 9:21 pm

I can confirm this bug: I get the strange characters in Opera 9.63 and in Konqueror 4.1.3.

As a quick workaround, don't use the compression for the response output:

Code: Select all

	private function compress($data, $level = 4) {

//		if (strpos(@$_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
//			$encoding = 'gzip';
//		}

//		if (strpos(@$_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip')) {
//			$encoding = 'x-gzip';
//		}
		......
This is not a complete solution, but at least it gets Opera and Konqueror going again.

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Daniel » Sat Feb 07, 2009 1:52 am

i'm posting a fix for this in the next release. I think the strange charater problem issomthing to do with the database installer.

OpenCart®
Project Owner & Developer.
OpenCart commercial support now available!


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by Daniel » Sat Feb 07, 2009 2:03 am

Copy and paste this into your response class:

Code: Select all

<?php
final class Response {
	private $headers = array(); 
	private $output;

	public function addHeader($key, $value) {
		$this->headers[$key] = $value;
	}

	public function removeHeader($key) {
		if (isset($this->headers[$key])) {
			unset($this->headers[$key]);
		}
	}

	public function redirect($url) {
		header('Location: ' . $url);
		exit;
	}

	public function setOutput($output) {
		$this->output = $output;
	}

	private function compress($data, $level = 4) {
		if (strpos(@$_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) {
			$encoding = 'gzip';
		} 

		if (strpos(@$_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip')) {
			$encoding = 'x-gzip';
		}

		if (!isset($encoding)) {
			return $data;
		}

		if (!extension_loaded('zlib') || ini_get('zlib.output_compression')) {
			return $data;
		}

		if (headers_sent()) {
			return $data;
		}

		if (connection_status()) {
			return $data;
		}

		$gzdata = gzencode($data, (int)$level);

		$this->addHeader('Content-Encoding', $encoding);

		return $gzdata;
	}

	public function output($level = 4) {
		if ($level) {
			$ouput = $this->compress($this->output, $level);
		} else {
			$ouput = $this->output;
		}		
		
		foreach ($this->headers as $key => $value) {
			header($key. ': ' . $value);
		}
				
		echo $ouput;
	}
}
?>

OpenCart®
Project Owner & Developer.
OpenCart commercial support now available!


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by JNeuhoff » Sat Feb 07, 2009 3:00 am

Thanks, that works. It looks like the HTTP-header 'Content-Encoding' needs to be placed before the other headers.

MHC Web Design
Override Engine * Integrated VQMod * Multilingual SEO * Instant Option Price Calculator * TrustPilot Reviews * Download Options * Free Download Buttons * Export/Import Tool * Template Switcher PHP/Twig


User avatar
Expert Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: No registered users and 11 guests