php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #4004 imap_errors() says it returns Array. I find String using gettype() on result.
Submitted: 2000-04-02 00:15 UTC Modified: 2000-04-03 02:12 UTC
From: rdoust at home dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 3.0.15 OS: WinNT 4.0
Private report: No CVE-ID: None
 [2000-04-02 00:15 UTC] rdoust at home dot com
$errs = imap_errors();
if ( count( $errs ) > 0 )
    printf( "$errs[0] );

This produces an error entry in my PHP log that the parameter I'm sending to count is not an array. I later try gettype() on $errs and I'm told it's a String. I print it's value and it's empty. Does this mean that I have no errors?

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-04-02 00:25 UTC] sterling at cvs dot php dot net
imap_errors should return an array, from the source of PHP:

void php3_imap_errors(INTERNAL_FUNCTION_PARAMETERS)
{
  ERRORLIST *cur=NIL;
  
  int arg_count = ARG_COUNT(ht);
  
  if (arg_count > 0) {
    WRONG_PARAM_COUNT;
  }
  
  if (imap_errorstack == NIL) {
    RETURN_FALSE;
  }
  
  array_init(return_value);
  cur = imap_errorstack;
  while (cur != NIL) {
    add_next_index_string(return_value,cur->LTEXT,1);
    cur = cur->next;
  }
  mail_free_errorlist(&imap_errorstack);
  imap_errorstack = NIL;
}

That is why I am going to move this to Misbehaving Functions.
 [2000-04-02 00:29 UTC] sterling at cvs dot php dot net
Oh yeah, I'm going to keep it open as well :)
 [2000-04-03 02:12 UTC] chagenbu at cvs dot php dot net
If there are no errors, it returns false:

  if (imap_errorstack == NIL) {
    RETURN_FALSE;
  }

So, do something that would cause an error, and then call
it. You'll get an array.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Mon Jun 15 14:00:01 2026 UTC