Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Check that $token[0] exists before trying to use it. #37

Merged
merged 1 commit into from
May 5, 2016

Conversation

ameir
Copy link
Contributor

@ameir ameir commented Nov 10, 2015

With Courier IMAP, you will get an error when checking for $token[0] for some responses, so we ensure that it exists first.

$tokens[] = $matches[1];
$line = substr($line, strlen($matches[0]));
continue;
if (isset($token[0])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this as '! isset(){continue}'

need to first check that $token[0] exists before trying to use it.
@ameir ameir force-pushed the courier-imap-token-fix branch from 2daab4d to 3e94c5b Compare November 10, 2015 17:23
@ameir
Copy link
Contributor Author

ameir commented Nov 10, 2015

All set, let me know if you need any other changes made.

@ameir
Copy link
Contributor Author

ameir commented Jan 10, 2016

@Maks3w @weierophinney do you have any concerns with merging this? I have a few more PRs to write, but want to make sure the path is clear to do so.

@Maks3w
Copy link
Member

Maks3w commented Mar 22, 2016

Need tests

@ameir
Copy link
Contributor Author

ameir commented Apr 10, 2016

@Maks3w current tests cover this code path, so I think it's fine test-wise.

@Maks3w
Copy link
Member

Maks3w commented Apr 11, 2016

If existing test cover this then this PR its not needed as those tests detect the failure and its fixed.

@ameir
Copy link
Contributor Author

ameir commented Apr 12, 2016

I'm not quite sure how to go about this since we're checking a server response. I ran tests against a real Courier IMAP server, so if TESTS_ZEND_MAIL_IMAP_HOST points to one, then you're set. I don't think it's worth mimicking a server for this, since this is just a small isset() that doesn't change logic for other servers at all. Let me know what you think.

@weierophinney weierophinney added this to the 2.7.1 milestone May 5, 2016
@weierophinney weierophinney self-assigned this May 5, 2016
@weierophinney weierophinney merged commit 3e94c5b into zendframework:master May 5, 2016
weierophinney added a commit that referenced this pull request May 5, 2016
Check that $token[0] exists before trying to use it.
weierophinney added a commit that referenced this pull request May 5, 2016
weierophinney added a commit that referenced this pull request May 5, 2016
weierophinney added a commit that referenced this pull request May 5, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants