Properly check for any boolean value query parameter

This commit is contained in:
Bernd Bestel 2020-01-27 22:20:20 +01:00
parent 5d83ec7967
commit 0e41500a63
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -568,7 +568,7 @@ class StockApiController extends BaseApiController
public function ProductStockEntries(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args) public function ProductStockEntries(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args)
{ {
$allowSubproductSubstitution = false; $allowSubproductSubstitution = false;
if (isset($request->getQueryParams()['include_sub_products']) && boolval($request->getQueryParams()['include_sub_products'])) if (isset($request->getQueryParams()['include_sub_products']) && filter_var($request->getQueryParams()['include_sub_products'], FILTER_VALIDATE_BOOLEAN))
{ {
$allowSubproductSubstitution = true; $allowSubproductSubstitution = true;
} }