From: jigermano at gmail dot com
Operating system:
PHP version: Irrelevant
PHP Bug Type: IMAP related
Bug description: Show user flags in imap_headerinfo
Description:
------------
Although imap_headers returns information regarding user flags for all the
mail in a folder, imap_headerinfo does not return such information for just
one message. I added this functionality:
--- tmp/php-4.3.9/ext/imap/php_imap.c Thu Aug 12 16:32:59 2004
+++ php-4.3.9/ext/imap/php_imap.c Thu Mar 10 21:22:31 2005
@@ -1463,12 +1463,13 @@
Read the headers of the message */
PHP_FUNCTION(imap_headerinfo)
{
- zval **streamind, **msgno, **fromlength, **subjectlength,
**defaulthost;
+ zval **streamind, **msgno, **fromlength, **subjectlength,
**defaulthost, *user_flags;
pils *imap_le_struct;
MESSAGECACHE *cache;
ENVELOPE *en;
char dummy[2000], fulladdress[MAILTMPLEN];
int myargc = ZEND_NUM_ARGS();
+ unsigned long i;
if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc,
&streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE)
{
ZEND_WRONG_PARAM_COUNT();
@@ -1513,6 +1514,19 @@
add_property_string(return_value, "Answered", cache->answered ?
"A" : " ", 1);
add_property_string(return_value, "Deleted", cache->deleted ? "D"
: " ", 1);
add_property_string(return_value, "Draft", cache->draft ? "X" : "
", 1);
+
+ if ((i = cache->user_flags)) {
+ add_property_bool(return_value, "HasUserFlag", 1);
+ MAKE_STD_ZVAL(user_flags);
+ array_init(user_flags);
+ while (i) {
+ add_next_index_string(user_flags,
imap_le_struct->imap_stream->user_flags[find_rightmost_bit (&i)] ,1);
+ }
+ add_property_zval(return_value, "UserFlags",user_flags);
+
+ }else{
+ add_property_bool(return_value, "HasUserFlag", 0);
+ }
sprintf(dummy, "%4ld", cache->msgno);
add_property_string(return_value, "Msgno", dummy, 1);
--
Edit bug report at http://bugs.php.net/?id=32268&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32268&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32268&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32268&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32268&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32268&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32268&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32268&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32268&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32268&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32268&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32268&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32268&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32268&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32268&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32268&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32268&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32268&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32268&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32268&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32268&r=mysqlcfg