Skip to content

Recursive handling of stdClass in response #577

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Connection/Protocols/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Webklex\PHPIMAP\Connection\Protocols;

use stdClass;
use Webklex\PHPIMAP\Exceptions\ResponseException;

/**
Expand Down Expand Up @@ -347,7 +348,7 @@ public function successful(): bool {
* @return bool
*/
public function verify_data(mixed $data): bool {
if (is_array($data)) {
if (is_array($data) || $data instanceof stdClass) {
foreach ($data as $line) {
if (is_array($line)) {
if(!$this->verify_data($line)){
Expand Down Expand Up @@ -414,4 +415,4 @@ public function setCanBeEmpty(bool $can_be_empty): Response {
public function canBeEmpty(): bool {
return $this->can_be_empty;
}
}
}
2 changes: 1 addition & 1 deletion src/Decoder/HeaderDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ private function decodeHeaderArray(array $values): array {
return $values;
}

}
}