PHP API BUG ??

[29] => Array
(
[.id] => *2A
[disabled] => no
[invalid] => no
[dynamic] => no
[name] => Queue1
=> target-addresses
[255.1xx.xxx/32,88.255.1xx.xxx/32,88.255.1xx.xx] =>
[/32,88.255.1xx.xxx/32,88.255.1xx.xxx/32,88.255.1xx.] =>
[xx/32,88.255.1xx.xxx/32,88.255.1xx.xxx/32,88.255.] =>
[05.xxx/32] => dst-address
[0.0] => interface
[th
] => priority
[t-small!r] => .id
[29] => dst-address
[interface] => all
[e] => default-small/default-small
[led] => no

[.0.0.0/0] => dst-netmask
[ent] => TOPLAM
[default-small!r] => .id
[55.155.58/32] => dst-address
[0.0.0] => interface
[both
] => priority
[0/0] => max-limit
[isabled] => no

[0] => dst-netmask
[PLAM] => direction
[0] => max-limit
] => .id
[.128/27,212.175.xxx.xxx/28] => dst-address
[dst-netmask] => 0.0.0.0
[
] => priority
)


when i try to get data with multiple target-addresses from queue , i got the problem

how can i fix it?

when i try it with single target-address, it works

[30] => Array
(
[.id] => *32
[disabled] => no
[invalid] => no
[dynamic] => no
[name] => Queue2
[target-addresses] => 88.255.1xx.xx/32
[dst-address] => 0.0.0.0/0
[dst-netmask] => 0.0.0.0
[interface] => all
[parent] => TOPLAM
[direction] => both
[priority] => 8
[queue] => default-small/default-small
[limit-at] => 0/0
[max-limit] => 0/0
[total-queue] => default-small
)

Hi, I have the same problem. I try 3.15 and 3.19.

Error print :
!re >>> [8, 24] =.id=*19 >>> [9, 14] =comment= >>> [9, 4] =name=VPN >>> [128, 719] �=target-addresses=10.1.1.222/32,10.1.1.223/32,10.1.1.224/32,10.1.1.225/32,10.1.1.226/32,10.1.1.227/32,10.1.1.228/32,10.1.1.229/ >>> [51, 667] 2=dst-address=0.0.0.0/0=interface=all=parent=SG >>> [79, 587] slavany=direction=both=priority=5=queue=default/default=limit-at=256000/256 >>> [48, 538] 00=max-limit=8000000/8000000=burst-limit=0/0= >>> [98, 439] urst-threshold=0/0=burst-time=0s/0s=total-queue=default�!re=.id=*1A =comment= =name=VoIP_x1-=t >>> [97, 341] rget-addresses=10.1.1.240/32,10.1.1.241/32=dst-address=0.0.0.0/0=interface=all=parent=SG Oslav >>> [97, 243] ny=direction=both=priority=1"=queue=default-small/default-small =limit-at=0/0=max-limit=256000 >>> [47, 195] 256000=burst-limit=0/0=burst-threshold=0/0=b >>> [117, 77] rst-time=0s/0s=total-queue=default-small�

I found error in read function. Problem with length calculation. This function work fine.

function read($parse = true) {

$STATUS = socket_get_status($this->socket);

$RESPONSE = array();

stream_set_timeout($this->socket, 2);

while (true) {

$tmp = ord(fread($this->socket, 1));

if ($tmp < 0x80) {
$LENGTH = $tmp;
} elseif ( $tmp < 0xC0) {
$tmp2 = ord(fread($this->socket, 1));
$LENGTH = ((($tmp0x100)+$tmp2) ^ 0x8000);
} elseif ( $tmp < 0xE0 ) {
$tmp2 = ord(fread($this->socket, 1));
$tmp3 = ord(fread($this->socket, 1));
$LENGTH = ((($tmp
0x10000)+($tmp20x100)+$tmp3) ^ 0xC00000);
} elseif ( $tmp < 0xF0 ) {
$tmp2 = ord(fread($this->socket, 1));
$tmp3 = ord(fread($this->socket, 1));
$tmp4 = ord(fread($this->socket, 1));
$LENGTH = ((($tmp
0x1000000)+($tmp20x10000)+($tmp30x100)+$tmp4) ^ 0xE0000000);
}

if ($LENGTH > 0) {

$_ = fread($this->socket, $LENGTH);

$RESPONSE = $_;

}

$STATUS = socket_get_status($this->socket);

if ($LENGTH > 0)
$this->debug(‘>>> [’ . $LENGTH . ', ’ . $STATUS[‘unread_bytes’] . '] ’ . $_);

if ( (!$this->connected && !$STATUS[‘unread_bytes’]) || ($this->connected && $_ == ‘!done’ && !$STATUS[‘unread_bytes’]) )
break;

if (($LENGTH == 0) and $STATUS[‘timed_out’])
break;

}

if ($parse)
$RESPONSE = $this->parse_response($RESPONSE);

return $RESPONSE;

}

Hi,
thanks for your fix for php read method. Right now I found out that there is some performance issues that some of you may also have.
It seems that certain commnans are very slow due to attempt to fread where there is no data.

/ip/firewall/filter/add=chain=FILTER-IN=dst-address=10.154.114.229=action=accept
/ip/firewall/filter/add=chain=FILTER-OUT=src-address=10.154.114.229=action=accept
/ip/firewall/filter/add=chain=FILTER-IN=dst-address=10.154.114.227=action=accept
/ip/firewall/filter/add=chain=FILTER-OUT=src-address=10.154.114.227=action=accept

each command sequence is blocked for 3 seconds which is default timeout value setted. I tried to add following condition at the end of while cycle, but in some cases it returns without data read, which are read in next read execution, so I get wrong response.

if (($LENGTH == 0 && !$STATUS['unread_bytes'])) {
   break;
}

Does anyone solved this performance issue ?