Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit ddbbee6

Browse files
author
Ivan Poddubny
committed
Fix a bug in AMI message parsing
Correctly handle messages containing * "A:B" (without a space after semicolon) * "A:" (like VarSet, where Value is empty)
1 parent 2a24dfe commit ddbbee6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

phpagi-asmanager.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,12 @@ function read_one_msg($allow_timeout = false)
195195
}
196196

197197
foreach ($msgarr as $num=>$str) {
198-
$kv = explode(': ', $str);
199-
$key = $kv[0];
200-
$val = $kv[1];
198+
$kv = explode(':', $str, 2);
199+
if (!isset($kv[1])) {
200+
$kv[1] = "";
201+
}
202+
$key = trim($kv[0]);
203+
$val = trim($kv[1]);
201204
$parameters[$key] = $val;
202205
}
203206

0 commit comments

Comments
 (0)