Skip to content

Commit bddf09b

Browse files
committed
fix bad request when parameters are an empty array
1 parent 5e00118 commit bddf09b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

.php-cs-fixer.cache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"php":"8.3.16","version":"3.68.5:v3.68.5#7bedb718b633355272428c60736dc97fb96daf27","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"strict_param":true},"hashes":{"tests\/resources\/expected\/complex-query-profile.php":"c0d16588e70d32588ec2e55ba5ae5873","tests\/Unit\/Neo4jExceptionUnitTest.php":"e07e604496e0e4032d2798ee9d2cb1b2","tests\/Unit\/ResultRowTest.php":"b4b307579a75da8307d6d65eb5548cae","tests\/Unit\/Neo4jQueryAPIUnitTest.php":"87e08aca0ccef5589c88bd7249e39496","tests\/Unit\/Neo4jRequestFactoryTest.php":"ebc6d5ee7790df4d69a5b555ad48ff5a","tests\/Unit\/AuthenticationTest.php":"746b185bcfb47a925e35b5b79b854fab","tests\/Integration\/Neo4jQueryAPIIntegrationTest.php":"43f34ad1774e3eeb133a9e3bb96f191d","tests\/Integration\/Neo4jTransactionIntegrationTest.php":"35fcbd5afbec5bb59f35040d9d6c518f","tests\/Integration\/Neo4jOGMTest.php":"e03f51ef605ca818763f3897d7a30830","src\/OGM.php":"211c087b78fca69390701e2f505e46fe","src\/Neo4jQueryAPI.php":"a7a505057617a2de3a94a73065254ecb","src\/BearerAuthentication.php":"51b5f02280a43838465cffa8974648c6","src\/Enums\/AccessMode.php":"88b5c70c4716cc68bcb86e2f162dd347","src\/Results\/ResultRow.php":"92dc1ec9315fa5236a79468ffaf9a60c","src\/Results\/ResultSet.php":"372faa2af185b25b804be1974c34b1ae","src\/Exception\/Neo4jException.php":"89c4c090cd3ba6e94c13eab7ebd0588c","src\/NoAuth.php":"2267e8a5b07aeaaab3165bb105b10807","src\/loginConfig.php":"47e9993051fc556a7fc28bc8f9a01caa","src\/AuthenticateInterface.php":"1da849c5d5b88439e01543d5d5b9f8d9","src\/BasicAuthentication.php":"ab50275cc6841d88d289a63d86ecb118","src\/Configuration.php":"fabfe6acf58bb0bda76453ace4f0757d","src\/ResponseParser.php":"e32270966c3a618bcb5ea9c6497748be","src\/Neo4jRequestFactory.php":"e3279d36e54032c6acf92df10ac47f07","src\/Objects\/Path.php":"e8091a19eb4e70ced4f8f7364dbe78be","src\/Objects\/Node.php":"ac679671f513c6c996dbf75a66fcacb2","src\/Objects\/Authentication.php":"f31af1c057be0f490cc2dba365f03b31","src\/Objects\/ProfiledQueryPlanArguments.php":"02b5fa2d50fec5d0fb0c4ada55ebda69","src\/Objects\/Person.php":"cee5594450a015103e12d4cbe186f167","src\/Objects\/Point.php":"4115d8d1b85a0d6e37b79d303237bcd0","src\/Objects\/ResultSet.php":"a5ba56fc6c6e250c22b183ac26dfd68e","src\/Objects\/ProfiledQueryPlan.php":"75ab6c3ad2ce97675a8e6478d17ac4d9","src\/Objects\/Bookmarks.php":"2c3e7229ce9b56c0352155b3feaac9bb","src\/Objects\/ResultCounters.php":"a9372c98fe7bede10cb004af30ea502f","src\/Objects\/Relationship.php":"e344e22d5a41f1795f3310d55ea51c20","src\/Transaction.php":"ff5454897ddbcc4fc2a984ecb90a90fd","src\/Authentication\/BearerAuthentication.php":"08a9e3c01d3833255cd51c94a17f1aa3","src\/Authentication\/NoAuth.php":"71cc7d784b9d98c62d2342faf38f7dc4","src\/Authentication\/AuthenticateInterface.php":"65b5a1074e11fba04362e754ad97023f","src\/Authentication\/BasicAuthentication.php":"c37b7ef26a59c032ac2a6a7b91c5adae"}}
1+
{"php":"8.3.6","version":"3.68.5:v3.68.5#7bedb718b633355272428c60736dc97fb96daf27","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":{"default":"at_least_single_space"},"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_parentheses":true,"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"imports_order":["class","function","const"],"sort_algorithm":"none"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":{"only_dec_inc":true},"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"attribute_placement":"ignore","on_multiline":"ensure_fully_multiline"},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"strict_param":true},"hashes":{"\/tmp\/PHP CS Fixertemp_folder6\/src\/Exception\/Neo4jException.php":"89c4c090cd3ba6e94c13eab7ebd0588c","\/tmp\/PHP CS Fixertemp_folder11\/src\/ResponseParser.php":"f9dc796ec34c286802808b9ca9f94862","\/tmp\/PHP CS Fixertemp_folder4\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder1094\/tests\/Integration\/Neo4jQueryAPIIntegrationTest.php":"d6a9417135719d3bfc00222ab2301a60","\/tmp\/PHP CS Fixertemp_folder9\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder10\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder1040\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder5\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder1106\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder513\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder944\/tests\/Integration\/Neo4jQueryAPIIntegrationTest.php":"d6a9417135719d3bfc00222ab2301a60","\/tmp\/PHP CS Fixertemp_folder461\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder1168\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder508\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder75\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder767\/src\/Configuration.php":"fabfe6acf58bb0bda76453ace4f0757d","\/tmp\/PHP CS Fixertemp_folder1289\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder80\/src\/Objects\/Bookmarks.php":"2c3e7229ce9b56c0352155b3feaac9bb","\/tmp\/PHP CS Fixertemp_folder118\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder1152\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder549\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder1368\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder242\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder1228\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder858\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder269\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder1145\/src\/Neo4jRequestFactory.php":"d9eec7dc6b56748a9097b779ebc7a44e","\/tmp\/PHP CS Fixertemp_folder880\/src\/Neo4jRequestFactory.php":"d9eec7dc6b56748a9097b779ebc7a44e","\/tmp\/PHP CS Fixertemp_folder264\/src\/Neo4jRequestFactory.php":"d9eec7dc6b56748a9097b779ebc7a44e","\/tmp\/PHP CS Fixertemp_folder658\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder550\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder889\/src\/Neo4jQueryAPI.php":"0688d3f3915a72eee24b319df606b717","\/tmp\/PHP CS Fixertemp_folder1144\/src\/Neo4jRequestFactory.php":"ef800efa0bd27dd3e8a1f263a0e3a533","\/tmp\/PHP CS Fixertemp_folder1541\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder817\/src\/Neo4jRequestFactory.php":"6b7262db17eab8d703e5562fd1813a38","\/tmp\/PHP CS Fixertemp_folder723\/src\/Neo4jRequestFactory.php":"23f8a99d7d638004b1f6c9259fa82ce6","\/tmp\/PHP CS Fixertemp_folder969\/src\/Neo4jRequestFactory.php":"23f8a99d7d638004b1f6c9259fa82ce6","\/tmp\/PHP CS Fixertemp_folder1424\/src\/Neo4jRequestFactory.php":"fa41f1e3afbe628175744d1aea611f61","\/tmp\/PHP CS Fixertemp_folder162\/src\/Neo4jRequestFactory.php":"2236b1204dc27dd61d372a012c519626","\/tmp\/PHP CS Fixertemp_folder111\/src\/Neo4jRequestFactory.php":"a5286fc4539607aa039af83c705d398f","\/tmp\/PHP CS Fixertemp_folder786\/src\/Configuration.php":"fabfe6acf58bb0bda76453ace4f0757d","src\/Neo4jRequestFactory.php":"a5286fc4539607aa039af83c705d398f","\/tmp\/PHP CS Fixertemp_folder1028\/src\/Neo4jRequestFactory.php":"a5286fc4539607aa039af83c705d398f","\/tmp\/PHP CS Fixertemp_folder721\/src\/Neo4jRequestFactory.php":"3498ab8d47b95a73c28df5f442a72491","\/tmp\/PHP CS Fixertemp_folder989\/src\/Neo4jRequestFactory.php":"3498ab8d47b95a73c28df5f442a72491","\/tmp\/PHP CS Fixertemp_folder771\/src\/Neo4jRequestFactory.php":"3498ab8d47b95a73c28df5f442a72491","\/tmp\/PHP CS Fixertemp_folder697\/src\/Neo4jRequestFactory.php":"3498ab8d47b95a73c28df5f442a72491","\/tmp\/PHP CS Fixertemp_folder420\/src\/Neo4jRequestFactory.php":"3498ab8d47b95a73c28df5f442a72491"}}

src/Neo4jRequestFactory.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,11 @@ private function createRequest(string $uri, ?string $cypher, ?array $parameters)
5656
{
5757
$request = $this->psr17Factory->createRequest('POST', $this->configuration->baseUri . $uri);
5858

59-
$payload = [
60-
'parameters' => $parameters ?? new \stdClass(),
61-
'includeCounters' => $this->configuration->includeCounters
62-
];
59+
$payload = [];
60+
61+
if ($this->configuration->includeCounters) {
62+
$payload['includeCounters'] = true;
63+
}
6364

6465
if ($this->configuration->accessMode === AccessMode::READ) {
6566
$payload['accessMode'] = AccessMode::READ;
@@ -81,7 +82,7 @@ private function createRequest(string $uri, ?string $cypher, ?array $parameters)
8182
$request = $request->withHeader('Content-Type', 'application/json');
8283
$request = $request->withHeader('Accept', 'application/vnd.neo4j.query');
8384

84-
$body = json_encode($payload, JSON_THROW_ON_ERROR);
85+
$body = json_encode($payload, JSON_THROW_ON_ERROR);
8586

8687
$stream = $this->streamFactory->createStream($body);
8788

0 commit comments

Comments
 (0)