Skip to content
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

Integer as value in IncidentsClientDecorator throws TypeError #1

Closed
brotkrueml opened this issue Dec 5, 2020 · 0 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@brotkrueml
Copy link
Contributor

brotkrueml commented Dec 5, 2020

Exception trace:

PHP Fatal error:  Uncaught TypeError: Argument 2 passed to Buzz\Browser::prepareMultipart() must be of the type string, int given, called in /xxx/vendor/kriswallsmith/buzz/lib/Browser.php on line 127 and defined in /xxx/vendor/kriswallsmith/buzz/lib/Browser.php:219
Stack trace:
#0 /xxx/vendor/kriswallsmith/buzz/lib/Browser.php(127): Buzz\Browser->prepareMultipart()
#1 /xxx/vendor/brotkrueml/jobrouter-client/src/Client/RestClient.php(200): Buzz\Browser->submitForm()
#2 /xxx/vendor/brotkrueml/jobrouter-client/src/Client/RestClient.php(156): Brotkrueml\JobRouterClient\Client\RestClient->sendForm()
#3 /xxx/start_instance.php(48): Brotkrueml\JobRouterClient\Client\RestClient->request()
#4 {main}
  thrown in /xxx/vendor/kriswallsmith/buzz/lib/Browser.php on line 219

Example:

$multipart = [
    'step' => '1',
    'summary' => 'Instance started via JobRouter Client',
    'processtable[fields][0][name]' => 'NAME',
    'processtable[fields][0][value]' => 'Max Mustermann',
    'subtables[0][name]' => 'KNOWLEDGE',
    'subtables[0][rows][0][fields][0][name]' => 'SUBJECT',
    'subtables[0][rows][0][fields][0][value]'=> 'Excel',
    'subtables[0][rows][0][fields][1][name]' => 'SELF_ASSESSMENT',
    'subtables[0][rows][0][fields][1][value]'=> 2,
];

$response = $client->request(
    'POST',
    'application/incidents/application',
    $multipart
);

Solution would be to cast an integer to a string for subtables.

@brotkrueml brotkrueml added the bug Something isn't working label Dec 5, 2020
@brotkrueml brotkrueml self-assigned this Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant