-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fields that are set to 0 are erroneously removed from request payload $params #271
Comments
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Is this issue solved? there has been no response form the developers so far. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Is this issue solved? there has been no response from the developers so far. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Is this issue solved? there has been no response from the developers so far. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Is this issue solved? there has been no response from the developers so far. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Is this issue solved? there has been no response from the developers so far. |
The workaround here is to remove the following line shopify-api-php/src/Rest/Base.php Line 180 in c26aee5
Here is a patch file for
|
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Is this issue solved? there has been no response from the developers so far. |
This issue is stale because it has been open for 60 days with no activity. It will be closed if no further action occurs in 14 days. |
Is this issue solved? there has been no response from the developers so far. |
Hey, sorry for the delay in responding here. The stalebot was removed, but the issue wasn't addressed yet. I've added it to our tracking now so we can follow it more closely, and we will look into fixing it. Thank you for your patience on this one! |
Issue summary
In
Base.php
, in therequest()
function, there is a call toarray_filter($params)
.shopify-api-php/src/Rest/Base.php
Line 178 in b26b415
If we send a payload where one of the request payload values is 0, (such as we want to set the inventory level of a product to 0, the call to
array_filter()
removes the entire value where 0 is set from the payload array, and thus the API will respond that the value is missing.Expected behavior
The value containing 0 should be passed to the API request and not be removed from the request payload.
Actual behavior
The request parameter containing a "0" gets removed and we receive an error, such as:
EXCEPTION encountered! REST request failed: {"available":"Required parameter missing or invalid"}
Steps to reproduce the problem
Send the following request:
The call will return with the following error:
EXCEPTION encountered! REST request failed: {"available":"Required parameter missing or invalid"}
When setting
available
to any value > 0, we will get a successful responseThe text was updated successfully, but these errors were encountered: