-
Notifications
You must be signed in to change notification settings - Fork 65
DEBUG_SDK checking if defined, not the defined value #32
Comments
This behaviour was made intentionally. The problem with the environment variables - they are always strings and must be converted to bool before use. So once getting the value you should guess, what is it? Should it be "false"/"true"? "Y"/"N"? "1"/"0"? How to react on "blablabla" inside the variable or "null" Too many variants. Of course - there is a function filter_var with FILTER_VALIDATE_BOOLEAN option, but this function has some amount of issues, like these: Some of them have status Closed, some Won't fix, but anyway - the reason why we decided to not to parse the input - just to simplify the checking function and avoid possible issues with type casting. I agree, that this can confuse and probably I need to change the README and add more details about the DEBUG_SDK flag. Thank you for the feedback! |
I've updated the README file in order to remove the confusion about the flag usage. Thank you for your feedback! |
Describe the bug
We're implementing the Klarna Checkout SDK for one of our customer projects and noticed that we were repeatedly getting a lot of debug information through the requests even though we had defined
DEBUG_SDK
as false. When we went into the code we could out why. You're correctly using getenv to check if the value exists and get the value, but you're then only checking if the constant is actually defined, not it's value.The issue is at this line:
kco_rest_php/src/Klarna/Rest/Resource.php
Line 142 in cf5c0e8
Which service do you use
Klarna Checkout
To Reproduce
Steps to reproduce the behavior:
DEBUG_SDK
constant as false as below:<?php define('DEBUG_SDK', false); ?>
Expected behavior
Klarna SDK debug output should not show.
The text was updated successfully, but these errors were encountered: