Skip to content
Merged
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip

## [UNRELEASED]
### Fixed
- NaN
- Fix case sensitivity of Folder attribute parsing (\NoSelect, \NoInferiors) #469 (thanks @smajti1)

### Added
- SSL stream context options added #238 #546 (thanks @llemoine)
Expand Down
4 changes: 2 additions & 2 deletions src/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,8 @@ protected function getSimpleName($delimiter, $full_name): string|bool {
* @param $attributes
*/
protected function parseAttributes($attributes): void {
$this->no_inferiors = in_array('\NoInferiors', $attributes);
$this->no_select = in_array('\NoSelect', $attributes);
$this->no_inferiors = in_array('\NoInferiors', $attributes, true) || \in_array('\Noinferiors', $attributes, true);
$this->no_select = in_array('\NoSelect', $attributes, true) || \in_array('\Noselect', $attributes, true);
$this->marked = in_array('\Marked', $attributes);
$this->referral = in_array('\Referral', $attributes);
$this->has_children = in_array('\HasChildren', $attributes);
Expand Down
42 changes: 42 additions & 0 deletions tests/issues/Issue469Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

namespace Tests\issues;

use PHPUnit\Framework\TestCase;
use Webklex\PHPIMAP\Client;
use Webklex\PHPIMAP\Folder;

class Issue469Test extends TestCase {

/**
* Test issue #469 - Case sensitive \NoSelect flag check doesn't work for Gmail
*/
public function testIssue(): void {
$client = $this->createStub(Client::class);
$folder_name = '[Gmail]';
$delimiter = '/';

$attributes = [
'\NoInferiors',
'\NoSelect',
];
$folder = new Folder($client, $folder_name, $delimiter, $attributes);

$attributes_lowercase = [
'\Noinferiors',
'\Noselect',
];
$folder_lowercase = new Folder($client, $folder_name, $delimiter, $attributes_lowercase);

self::assertSame(
$folder->no_inferiors,
$folder_lowercase->no_inferiors,
'The parsed "\NoInferiors" attribute does not match the parsed "\Noinferiors" attribute'
);
self::assertSame(
$folder->no_select,
$folder_lowercase->no_select,
'The parsed "\NoSelect" attribute does not match the parsed "\Noselect" attribute'
);
}
}