Project

General

Profile

Bug #34

Webclient uses deprecated function split() as of php 5.3.0

Added by Anonymous over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
fixed

Description

After updating to Ubuntu 10.04, this line in webclient:
list( $retarr[$index]['id'], $retarr[$index]['deviceicon'], $retarr[$index]['devicename'], $retarr[$index]['devicelocation'], $retarr[$index]['devicevalue'], $retarr[$index]['devicelabel'], $retarr[$index]['devicevalue2'], $retarr[$index]['devicelabel2'], $retarr[$index]['devicevalue3'], $retarr[$index]['devicelabel3'], $retarr[$index]['devicevalue4'], $retarr[$index]['devicelabel4'], $retarr[$index]['devicelastseen']) = split (';;', $item);
Throws a deprecated warning in the webclient, according to the docs @ http://php.net/manual/en/function.split.php
it would need to be replaced with: preg_split.
Tried just inserting preg_split instead of split which splits in the wrong way. Not enough experience with php to fix it myself :(

History

#1 Updated by Anonymous over 8 years ago

An inline replcae of split with explode makes the mainview work again. Other soluction is to use
preg_split ('/;;/', $item);
instead of
split (';;', $item);

There appears to be still an error with 'setview=pachube' however, should I open another ticket for that?

For clarity the error:
Warning: xmlrpc_is_fault() expects parameter 1 to be array, string given in /var/www/domotiga/index.php on line 52

Warning: Cannot modify header information - headers already sent by (output started at /var/www/domotiga/index.php:52) in /var/www/domotiga/index.php on line 55

#2 Updated by rdnzl over 8 years ago

The split function has been replaceby explode in revision #371.

Regarding the pachube error, are you sure you have defined pachube devices?
I get this error only when no devices are defined as far as I can see.

#3 Updated by Anonymous over 8 years ago

Thanx for the fix, I used preg_split myself, but it's "lood om oud ijzer" ;)

regarding pachube:
I defined devices and before they were picked up by pachube, the error I get is:


Warning: xmlrpc_is_fault() expects parameter 1 to be array, string given in /var/www/domotiga/index.php on line 52

Warning: Cannot modify header information - headers already sent by (output started at /var/www/domotiga/index.php:52) in /var/www/domotiga/index.php on line 55
temperature livingroom 19.125 Celcius temperature balcony 9 Celcius temperature bathroom 19 Celcius temperature kitchen 19.2 Celcius home power 70 Watt wasmachine power 0 Watt laptop1 power 0 Watt htpc power 70.69 Watt tv power 61.572 Watt laptop2 power 2.166 Watt freezer power 129.245 Watt fridge power 0 Watt afzuiging power 0 Watt harddrive1 temperature 21 Celcius harddrive2 temperature 19 Celcius

Commenting the xmlrpc-error check on lines 51-54 and 57 like this:
//   if (xmlrpc_is_fault($response)) {
//       trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
//   } else {
     header("Content-type: application/xml");
     print($response);
//   }

Presents me an xml-formatted file again.

#4 Updated by rdnzl over 8 years ago

  • Status changed from New to Closed
  • Resolution set to fixed

xmlrpc_is_fault() appears to only accept arrays as argument, so I added a check for this in revision #372, I just could remove it all together like you did, but maybe they change their mind, since xmlrpc_is_fault() is still marked as experimental function on php.net

#5 Updated by Anonymous over 8 years ago

I like your solution better, mine was just a dirty quick-n-dirty work-around ;)
Thanks

Also available in: Atom PDF