Bug #4518: wrong number of parameters checked in imap_delete and imap_undelete

From: Date: Fri, 19 May 2000 12:32:47 +0000
Subject: Bug #4518: wrong number of parameters checked in imap_delete and imap_undelete
Groups: php.dev 
Request: Send a blank email to php-dev+get-18949@lists.php.net to get a copy of this message
From: diego@nwbox.com Operating system: Linux / ALL PHP version: 3.0.15 PHP Bug Type: IMAP related Bug description: wrong number of parameters checked in imap_delete and imap_undelete The number of arguments in imap_delete and in imap_undelete is 2. So in both functions: if ( myargc < 3 || myargc > 4 || getParameters(....) == FAILURE ) { WRONG_PARAM_COUNT; } fails for example with IMP, and I believe with all the IMAP apps. This is a quick patch to fix the imap.c functions. diff -Naur php-3.0.15.orig/functions/imap.c php-3.0.15/functions/imap.c --- php-3.0.15.orig/functions/imap.c Mon Feb 14 08:11:46 2000 +++ php-3.0.15/functions/imap.c Fri May 19 06:35:33 2000 @@ -1554,7 +1554,7 @@ pils *imap_le_struct; int myargc=ARG_COUNT(ht); - if ( myargc < 3 || myargc > 4 || getParameters(ht,myargc,&streamind,&sequence,&flags) == FAILURE) { + if ( myargc != 2 || getParameters(ht,myargc,&streamind,&sequence,&flags) == FAILURE) { WRONG_PARAM_COUNT; } @@ -1569,7 +1569,7 @@ RETURN_FALSE; } - mail_setflag_full(imap_le_struct->imap_stream,sequence->value.str.val,"\\DELETED",myargc == 4 ? flags->value.lval : NIL); + mail_setflag_full(imap_le_struct->imap_stream,sequence->value.str.val,"\\DELETED",myargc == 2 ? flags->value.lval : NIL); RETVAL_TRUE; } /* }}} */ @@ -1583,7 +1583,7 @@ pils *imap_le_struct; int myargc=ARG_COUNT(ht); - if ( myargc < 3 || myargc > 4 || getParameters(ht,myargc,&streamind,&sequence,&flags) == FAILURE) { + if ( myargc != 2 || getParameters(ht,myargc,&streamind,&sequence,&flags) == FAILURE) { WRONG_PARAM_COUNT; } convert_to_long(streamind); @@ -1597,7 +1597,7 @@ RETURN_FALSE; } - mail_clearflag_full(imap_le_struct->imap_stream,sequence->value.str.val,"\\DELETED",myargc == 4 ? flags->value.lval : NIL); + mail_clearflag_full(imap_le_struct->imap_stream,sequence->value.str.val,"\\DELETED",myargc == 2 ? flags->value.lval : NIL); RETVAL_TRUE; } /* }}} */

« previous php.dev (#18949) next »