Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

  • Ben January 2013
Subscribe and unsubscribe response when boolean = true
  • Vote Up0Vote Down BasukeBasuke
    Posts: 2Sendy user

    On the subscribe and unsubscribe request with boolean=true, the response is not the same with the document. It says api will return "true", but actually it return "1". It is based on the following php code on subscribe.php:387,

    echo true;
    

    You know when the boolean will convert to string, it will be converted to integer, that means true become "1". Please fix in the next version.

  • 1 Comment
  • Vote Up0Vote Down BenBen
    Posts: 3,484Sendy support

    true and 1 is essentially the same thing.

    If you spit the result in the browser, a real true boolean will be displayed as 1. If not, it is a string, not a boolean.

    When you test for a result in your code like so:

    if($subscribed == true)

    or

    if($subscribed == 1)

    or

    if($subscribed)

    it will all be positive.

    You can download this simple script I've written to test it out.

    Thanks.

    Ben

This discussion has been closed.
All Discussions