json_encode() Warning

PaulThomas
Posts: 3
Joined: Fri Mar 16, 2012 9:41 am
Location: Sydney Australia
Contact:

json_encode() Warning

Postby PaulThomas » Fri Mar 16, 2012 9:49 am

Hi,

Has any one experienced the following issue?

Warning: json_encode() expects exactly 1 parameter, 2 given in /home/xxxxxxx/public_html/Cache/Cookie.php on line 47

This error appears in the main desktop website. The following WURFL script is placed in the header. The error is on http://www.visioninwhite.com.au

Code: Select all

<?php
// Include the WURFL Cloud Client
// You'll need to edit this path
require_once '././Client/Client.php';
// Create a configuration object
$config = new WurflCloud_Client_Config();
// Set your WURFL Cloud API Key
$config->api_key = 'xxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
// Create the WURFL Cloud Client
$client = new WurflCloud_Client_Client($config);
// Detect your device
$client->detectDevice();
// Use the capabilities
if ($client->getDeviceCapability('is_wireless_device')) {
header("Location: http://m.visioninwhite.com.au/");
}
?>
Thanks in advance for your help.

Cheers,
Paul

PaulThomas
Posts: 3
Joined: Fri Mar 16, 2012 9:41 am
Location: Sydney Australia
Contact:

Re: json_encode() Warning - Solved

Postby PaulThomas » Fri Mar 16, 2012 10:28 am

I'm going to see how this fix pans out.

I found that the default handler for '$cookie_sent' was 'false' in Cookie.php on line 18. I have set it to 'true' and now the issue is resolved.

Code: Select all

class WurflCloud_Cache_Cookie implements WurflCloud_Cache_CacheInterface {
	public $cookie_name = 'WurflCloud_Client';
	public $cache_expiration = 86400;
	private $cookie_sent = true;
Hope this helps someone else!

Cheers,
Paul

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: json_encode() Warning

Postby kamermans » Fri Mar 16, 2012 11:16 am

Hi Paul,

Thank you for your post. I am able to reproduce the issue with PHP versions less than 5.3.0. We will update the code to work without warnings in PHP < 5.3 and post back when the new version is available.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

kamermans
Posts: 393
Joined: Mon Jun 06, 2011 9:50 am

Re: json_encode() Warning

Postby kamermans » Fri Mar 16, 2012 11:52 am

There were some other changes in the queue, so we've released them as well as version 1.0.1, available from you account immediately.
Thanks,

Steve Kamerman
ScientiaMobile

Make sure you check out our WURFL Cloud, WURFL InSight and WURFL InFuze products!

PaulThomas
Posts: 3
Joined: Fri Mar 16, 2012 9:41 am
Location: Sydney Australia
Contact:

Re: json_encode() Warning Solved

Postby PaulThomas » Fri Mar 16, 2012 12:42 pm

Hi Steve,

Thank you for the update. Yes, the PHP version we are using is 5.2.12. Will arrange an update to the latest PHP stable release!

Otherwise, the WURFL API is brilliant! 10 minute set up!

Cheers and thanks again.
Paul Thomas


Who is online

Users browsing this forum: No registered users and 10 guests