Skip to content

Commit 082a58c

Browse files
committed
Fix Vonage#52 - cast 'NUMBER_SEARCH_CRITERIA' as (string). Added comment to caution use of criteria starting with '0' to avoid conversion-to-octal issues. Added some more comments while I was at it to help users understand the use of the filter object
1 parent 13ceb76 commit 082a58c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

numbers/search-available.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,17 @@
99
$client = new \Vonage\Client($basic);
1010

1111
/** @var IterableAPICollection $response */
12+
/** Note: be careful when specifying "NUMBER_SEARCH_CRITERIA" environment variable:
13+
* surround it with quotes if it has a leading zero, otherwise the (string) conversion
14+
* will assume it is an Octal number and convert it. e.g., (string)0123 results in "83".
15+
* NUMBER_SEARCH_PATTERN will be one of 0 (search for numbers that start with pattern);
16+
* 1 (search for numbers that contain pattern), or 2 (search for numbers that end with pattern).
17+
* VONAGE_NUMBER_TYPE must be one of: landline, mobile-lvn or landline-toll-free
18+
* VONAGE_NUMBER_FEATURES Must be one of: SMS, VOICE, SMS,VOICE, MMS, SMS,MMS, VOICE,MMS
19+
* or SMS,MMS,VOICE
20+
*/
1221
$filter = new AvailableNumbers([
13-
"pattern" => (int) NUMBER_SEARCH_CRITERIA,
22+
"pattern" => (string)NUMBER_SEARCH_CRITERIA,
1423
"search_pattern" => (int) NUMBER_SEARCH_PATTERN,
1524
"type" => VONAGE_NUMBER_TYPE,
1625
"features" => VONAGE_NUMBER_FEATURES,

0 commit comments

Comments
 (0)