-
Type:
Bug
-
Status: Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 14
-
Fix Version/s: None
-
Component/s: CID Superfecta
-
Labels:None
-
ToDo:
-
Asterisk Version:16.6.2
-
Distro Version:14.0.13.23
-
Distro:FreePBX Distro
Sending (for example) 2042374134 into CID Superfecta when one of the methods is Can411 returns the following string:
Santa Lucia Pizza4 St Mary's Rd, Winnipeg, MB   R2H 1H1
There is no space before the address and there are supurious characters in the address.
The lack of space before the address is caused by completely stripping out newlines instad of changing them to a space. The spurious characters in the address are caused by entities in the value returned from canada411.ca.
I propose the following fixes to modules/superfecta/includes/superfecta_base.php:
At lines 1321 and 1350, change the preg_replace to use a '+' match modifer and replace matches with space instead of an empty string, as follows:
From: preg_replace('/[\n\r\t]*/i', '', $value)
To: preg_replace('/[\n\r\t]+/i', ' ', $value)
At line 1350, add a new line to replace entities with spaces:
match[$index] = preg_replace('/ /i', ' ', $match[$index]);
I have implemented these changes on my own system and they are working well.