Skip to content

handle importXmlInternalError gracefully in RO.php - #57

Merged
Vitexus merged 1 commit into
Spoje-NET:mainfrom
wpj-cz:main
Feb 13, 2025
Merged

Vitexus merged 1 commit into
Spoje-NET:mainfrom
wpj-cz:main

Conversation

@ovalek

@ovalek ovalek commented Feb 11, 2025

Copy link
Copy Markdown
Contributor

Hello. parseResponse() in RO.php throws Cannot access offset of type string on string TypeError from line 1301 when response from FlexiBee came with following data:

["@version" => "1.0", "success" => "false", "stats" => ["created" => "0", "updated" => "1", "deleted" => "0", "skipped" => "0", "failed" => "0"], "results" => [["errors" => [["message" => "Interní chyba aplikace.", "messageCode" => "importXmlInternalError"]]]]]

That makes it hard to diagnose problems, because it strips out relevant information from the FlexiBee response. This commit adds fallback for such cases (when message is not found where expected).

I'm not all that sure about existing $responseDecoded[key($responseDecoded)]['message'] case, but I wanted to suggest changes with minimal impact.

parseResponse() was throwing "Cannot access offset of type string on string" from line 1301 when response from FlexiBee came with following data:
```
["@Version" => "1.0", "success" => "false", "stats" => ["created" => "0", "updated" => "1", "deleted" => "0", "skipped" => "0", "failed" => "0"], "results" => [["errors" => [["message" => "Interní chyba aplikace.", "messageCode" => "importXmlInternalError"]]]]]
```
That made it hard to diagnose problems, because it stripped out relevant information from FlexiBee response. This commit adds fallback for this case when message is not found where expected.
@Vitexus Vitexus self-assigned this Feb 13, 2025
@Vitexus
Vitexus merged commit a71dd03 into Spoje-NET:main Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants