Skip to content

Commit

Permalink
Fix Vonage#52 - cast 'NUMBER_SEARCH_CRITERIA' as (string). Added comm…
Browse files Browse the repository at this point in the history
…ent 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
  • Loading branch information
gthoffer committed Oct 2, 2020
1 parent d7b37a1 commit f4a94f2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion numbers/search-available.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,17 @@
$client = new \Vonage\Client($basic);

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

0 comments on commit f4a94f2

Please sign in to comment.