# Patch: Add INTERNALDATE to imap_append()

- Thread: https://externals.io/message/45847
- Original archive: https://news-web.php.net/php.internals/45847
- Started by Nick Fortenberry on 2009-10-20T22:10:10+00:00
- Messages: 8
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #45847 — Nick Fortenberry — 2009-10-20T22:10:10+00:00

URL: https://externals.io/message/45847#45847

Hey everyone,

Jake Levitt and I created this patch which adds the option to set a message's INTERNALDATE when appending it to a mail server using imap.  Any chance we can get this included into the php 5.3 and 6 development branches?  The diff below was done against the php-src/branches/PHP_5_3 branch.  If you guys need me to apply the changes to a different branch or snapshot, please let me know.

Here's the svn diff (done in my repo)... if you need something else please let me know:


Index: ext/imap/php_imap.c
===================================================================
--- ext/imap/php_imap.c        (revision 3405)
+++ ext/imap/php_imap.c        (revision 3406)
@@ -41,6 +41,7 @@
#include "ext/standard/info.h"
#include "ext/standard/file.h"
#include "ext/standard/php_smart_str.h"
+#include "ext/pcre/php_pcre.h"

#ifdef ERROR
#undef ERROR
@@ -118,6 +119,7 @@
       ZEND_ARG_INFO(0, folder)
       ZEND_ARG_INFO(0, message)
       ZEND_ARG_INFO(0, options)
+        ZEND_ARG_INFO(0, date)
ZEND_END_ARG_INFO()

ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
@@ -1270,20 +1272,43 @@
PHP_FUNCTION(imap_append)
{
       zval *streamind;
-        char *folder, *message, *flags = NULL;
-        int folder_len, message_len, flags_len = 0;
+        char *folder, *message, *date = NULL, *flags = NULL;
+        int folder_len, message_len, date_len = 0, flags_len = 0;
       pils *imap_le_struct;
       STRING st;

-        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|s", &streamind, &folder, &folder_len, &message, &message_len, &flags, &flags_len) == FAILURE) {
+        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|ss", &streamind, &folder, &folder_len, &message, &message_len, &flags, &flags_len, &date, &date_len) == FAILURE) {
               return;
       }

+        char* regex = "/[ 0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/";
+        int regex_len = strlen(regex);
+        pcre_cache_entry *pce;                                //Compiled regex
+        zval *subpats = NULL;                                //Parts (not used)
+        long regex_flags = 0;                                //Flags (not used)
+        long start_offset = 0;                                //Start offset (not used)
+        int global = 0;
+
+        if (date) {
+                //Make sure the given date string matches the RFC specified format
+                if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
+                        RETURN_FALSE;
+                }
+
+                php_pcre_match_impl(pce, date, date_len, return_value, subpats, global,
+                        0, regex_flags, start_offset TSRMLS_CC);
+
+                if (!Z_LVAL_P(return_value)) {
+                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted");
+                        date = NULL;
+                }
+        }
+
       ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap);

       INIT (&st, mail_string, (void *) message, message_len);

-        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), NIL, &st)) {
+        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), (date ? date : NIL), &st)) {
               RETURN_TRUE;
       } else {
               RETURN_FALSE;



Thanks,

- Nick Fortenberry

---

## #45848 — Pierre Joye — 2009-10-20T22:13:04+00:00

URL: https://externals.io/message/45847#45848 · In reply to: #45847

hi,

Can you open a bug report and post a link to the patch please? So we
won't loose it in the ML archive. A test case would also be useful.

Cheers,


> Hey everyone,
>
> Jake Levitt and I created this patch which adds the option to set a message's INTERNALDATE when appending it to a mail server using imap.  Any chance we can get this included into the php 5.3 and 6 development branches?  The diff below was done against the php-src/branches/PHP_5_3 branch.  If you guys need me to apply the changes to a different branch or snapshot, please let me know.
>
> Here's the svn diff (done in my repo)... if you need something else please let me know:
>
>
> Index: ext/imap/php_imap.c
> ===================================================================
> --- ext/imap/php_imap.c        (revision 3405)
> +++ ext/imap/php_imap.c        (revision 3406)
> @@ -41,6 +41,7 @@
> #include "ext/standard/info.h"
> #include "ext/standard/file.h"
> #include "ext/standard/php_smart_str.h"
> +#include "ext/pcre/php_pcre.h"
>
> #ifdef ERROR
> #undef ERROR
> @@ -118,6 +119,7 @@
>       ZEND_ARG_INFO(0, folder)
>       ZEND_ARG_INFO(0, message)
>       ZEND_ARG_INFO(0, options)
> +        ZEND_ARG_INFO(0, date)
> ZEND_END_ARG_INFO()
>
> ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
> @@ -1270,20 +1272,43 @@
> PHP_FUNCTION(imap_append)
> {
>       zval *streamind;
> -        char *folder, *message, *flags = NULL;
> -        int folder_len, message_len, flags_len = 0;
> +        char *folder, *message, *date = NULL, *flags = NULL;
> +        int folder_len, message_len, date_len = 0, flags_len = 0;
>       pils *imap_le_struct;
>       STRING st;
>
> -        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|s", &streamind, &folder, &folder_len, &message, &message_len, &flags, &flags_len) == FAILURE) {
> +        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|ss", &streamind, &folder, &folder_len, &message, &message_len, &flags, &flags_len, &date, &date_len) == FAILURE) {
>               return;
>       }
>
> +        char* regex = "/[ 0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/";
> +        int regex_len = strlen(regex);
> +        pcre_cache_entry *pce;                                //Compiled regex
> +        zval *subpats = NULL;                                //Parts (not used)
> +        long regex_flags = 0;                                //Flags (not used)
> +        long start_offset = 0;                                //Start offset (not used)
> +        int global = 0;
> +
> +        if (date) {
> +                //Make sure the given date string matches the RFC specified format
> +                if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
> +                        RETURN_FALSE;
> +                }
> +
> +                php_pcre_match_impl(pce, date, date_len, return_value, subpats, global,
> +                        0, regex_flags, start_offset TSRMLS_CC);
> +
> +                if (!Z_LVAL_P(return_value)) {
> +                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted");
> +                        date = NULL;
> +                }
> +        }
> +
>       ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap);
>
>       INIT (&st, mail_string, (void *) message, message_len);
>
> -        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), NIL, &st)) {
> +        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), (date ? date : NIL), &st)) {
>               RETURN_TRUE;
>       } else {
>               RETURN_FALSE;
>
>
>
> Thanks,
>
> - Nick Fortenberry
>
>
>
> --
> 
> 
>
>



-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #45849 — Nick Fortenberry — 2009-10-20T22:17:10+00:00

URL: https://externals.io/message/45847#45849 · In reply to: #45848

Hey Pierre,

No problem.  We'll work on a test case and post a bug report when we've created it.

Thanks,
Nick Fortenberry


-----Original Message-----
From: "Pierre Joye" <pierre.php@gmail.com>
Sent: Tuesday, October 20, 2009 6:13pm
To: "Nick Fortenberry" <nick@mailtrust.com>
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] Patch: Add INTERNALDATE to imap_append()

hi,

Can you open a bug report and post a link to the patch please? So we
won't loose it in the ML archive. A test case would also be useful.

Cheers,


> Hey everyone,
>
> Jake Levitt and I created this patch which adds the option to set a message's INTERNALDATE when appending it to a mail server using imap.  Any chance we can get this included into the php 5.3 and 6 development branches?  The diff below was done against the php-src/branches/PHP_5_3 branch.  If you guys need me to apply the changes to a different branch or snapshot, please let me know.
>
> Here's the svn diff (done in my repo)... if you need something else please let me know:
>
>
> Index: ext/imap/php_imap.c
> ===================================================================
> --- ext/imap/php_imap.c        (revision 3405)
> +++ ext/imap/php_imap.c        (revision 3406)
> @@ -41,6 +41,7 @@
> #include "ext/standard/info.h"
> #include "ext/standard/file.h"
> #include "ext/standard/php_smart_str.h"
> +#include "ext/pcre/php_pcre.h"
>
> #ifdef ERROR
> #undef ERROR
> @@ -118,6 +119,7 @@
>       ZEND_ARG_INFO(0, folder)
>       ZEND_ARG_INFO(0, message)
>       ZEND_ARG_INFO(0, options)
> +        ZEND_ARG_INFO(0, date)
> ZEND_END_ARG_INFO()
>
> ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
> @@ -1270,20 +1272,43 @@
> PHP_FUNCTION(imap_append)
> {
>       zval *streamind;
> -        char *folder, *message, *flags = NULL;
> -        int folder_len, message_len, flags_len = 0;
> +        char *folder, *message, *date = NULL, *flags = NULL;
> +        int folder_len, message_len, date_len = 0, flags_len = 0;
>       pils *imap_le_struct;
>       STRING st;
>
> -        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|s", &streamind, &folder, &folder_len, &message, &message_len, &flags, &flags_len) == FAILURE) {
> +        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|ss", &streamind, &folder, &folder_len, &message, &message_len, &flags, &flags_len, &date, &date_len) == FAILURE) {
>               return;
>       }
>
> +        char* regex = "/[ 0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/";
> +        int regex_len = strlen(regex);
> +        pcre_cache_entry *pce;                                //Compiled regex
> +        zval *subpats = NULL;                                //Parts (not used)
> +        long regex_flags = 0;                                //Flags (not used)
> +        long start_offset = 0;                                //Start offset (not used)
> +        int global = 0;
> +
> +        if (date) {
> +                //Make sure the given date string matches the RFC specified format
> +                if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
> +                        RETURN_FALSE;
> +                }
> +
> +                php_pcre_match_impl(pce, date, date_len, return_value, subpats, global,
> +                        0, regex_flags, start_offset TSRMLS_CC);
> +
> +                if (!Z_LVAL_P(return_value)) {
> +                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted");
> +                        date = NULL;
> +                }
> +        }
> +
>       ZEND_FETCH_RESOURCE(imap_le_struct, pils *, &streamind, -1, "imap", le_imap);
>
>       INIT (&st, mail_string, (void *) message, message_len);
>
> -        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), NIL, &st)) {
> +        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), (date ? date : NIL), &st)) {
>               RETURN_TRUE;
>       } else {
>               RETURN_FALSE;
>
>
>
> Thanks,
>
> - Nick Fortenberry
>
>
>
> --
> 
> 
>
>



-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #45852 — Jani Taskinen — 2009-10-21T06:55:25+00:00

URL: https://externals.io/message/45847#45852 · In reply to: #45847

> Hey everyone,
>
> Jake Levitt and I created this patch which adds the option to set a message's INTERNALDATE when appending it to a mail server using imap.  Any chance we can get this included into the php 5.3 and 6 development branches?  The diff below was done against the php-src/branches/PHP_5_3 branch.  If you guys need me to apply the changes to a different branch or snapshot, please let me know.
>
> Here's the svn diff (done in my repo).. if you need something else please let me know:
>

There are several problems with it. Whitespace and C++ comments being 
the least. :) We have ext/date which is always there, I suggest you use 
those functions to handle dates instead of flaky regexps.

--Jani

>
> Index: ext/imap/php_imap.c
> ===================================================================
> --- ext/imap/php_imap.c        (revision 3405)
> +++ ext/imap/php_imap.c        (revision 3406)
> @@ -41,6 +41,7 @@
> #include "ext/standard/info.h"
> #include "ext/standard/file.h"
> #include "ext/standard/php_smart_str.h"
> +#include "ext/pcre/php_pcre.h"
>
> #ifdef ERROR
> #undef ERROR
> @@ -118,6 +119,7 @@
>         ZEND_ARG_INFO(0, folder)
>         ZEND_ARG_INFO(0, message)
>         ZEND_ARG_INFO(0, options)
> +        ZEND_ARG_INFO(0, date)
> ZEND_END_ARG_INFO()
>
> ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
> @@ -1270,20 +1272,43 @@
> PHP_FUNCTION(imap_append)
> {
>         zval *streamind;
> -        char *folder, *message, *flags = NULL;
> -        int folder_len, message_len, flags_len = 0;
> +        char *folder, *message, *date = NULL, *flags = NULL;
> +        int folder_len, message_len, date_len = 0, flags_len = 0;
>         pils *imap_le_struct;
>         STRING st;
>
> -        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|s",&streamind,&folder,&folder_len,&message,&message_len,&flags,&flags_len) == FAILURE) {
> +        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|ss",&streamind,&folder,&folder_len,&message,&message_len,&flags,&flags_len,&date,&date_len) == FAILURE) {
>                 return;
>         }
>
> +        char* regex = "/[ 0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/";
> +        int regex_len = strlen(regex);
> +        pcre_cache_entry *pce;                                //Compiled regex
> +        zval *subpats = NULL;                                //Parts (not used)
> +        long regex_flags = 0;                                //Flags (not used)
> +        long start_offset = 0;                                //Start offset (not used)
> +        int global = 0;
> +
> +        if (date) {
> +                //Make sure the given date string matches the RFC specified format
> +                if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
> +                        RETURN_FALSE;
> +                }
> +
> +                php_pcre_match_impl(pce, date, date_len, return_value, subpats, global,
> +                        0, regex_flags, start_offset TSRMLS_CC);
> +
> +                if (!Z_LVAL_P(return_value)) {
> +                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted");
> +                        date = NULL;
> +                }
> +        }
> +
>         ZEND_FETCH_RESOURCE(imap_le_struct, pils *,&streamind, -1, "imap", le_imap);
>
>         INIT (&st, mail_string, (void *) message, message_len);
>
> -        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), NIL,&st)) {
> +        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), (date ? date : NIL),&st)) {
>                 RETURN_TRUE;
>         } else {
>                 RETURN_FALSE;
>
>
>
> Thanks,
>
> - Nick Fortenberry

---

## #45856 — Nick Fortenberry — 2009-10-21T15:37:23+00:00

URL: https://externals.io/message/45847#45856 · In reply to: #45852

Hey Jani,

We looked through the date library but it doesn't look like there are any functions to verify that a date is in a certain format.  Unless we are mistaken, it looks like the only way to verify this would be to use a regex.

Also, we read through CODING_STANDARDS and it said to be generous with whitespace and brackets.  Were you referring to something in particular with regards to whitespace?

Thanks,
Nick


-----Original Message-----
From: "Jani Taskinen" <jani.taskinen@iki.fi>
Sent: Wednesday, October 21, 2009 2:55am
To: "Nick Fortenberry" <nick@mailtrust.com>
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] Patch: Add INTERNALDATE to imap_append()


> Hey everyone,
>
> Jake Levitt and I created this patch which adds the option to set a message's INTERNALDATE when appending it to a mail server using imap.  Any chance we can get this included into the php 5.3 and 6 development branches?  The diff below was done against the php-src/branches/PHP_5_3 branch.  If you guys need me to apply the changes to a different branch or snapshot, please let me know.
>
> Here's the svn diff (done in my repo).. if you need something else please let me know:
>

There are several problems with it. Whitespace and C++ comments being 
the least. :) We have ext/date which is always there, I suggest you use 
those functions to handle dates instead of flaky regexps.

--Jani

>
> Index: ext/imap/php_imap.c
> ===================================================================
> --- ext/imap/php_imap.c        (revision 3405)
> +++ ext/imap/php_imap.c        (revision 3406)
> @@ -41,6 +41,7 @@
> #include "ext/standard/info.h"
> #include "ext/standard/file.h"
> #include "ext/standard/php_smart_str.h"
> +#include "ext/pcre/php_pcre.h"
>
> #ifdef ERROR
> #undef ERROR
> @@ -118,6 +119,7 @@
>         ZEND_ARG_INFO(0, folder)
>         ZEND_ARG_INFO(0, message)
>         ZEND_ARG_INFO(0, options)
> +        ZEND_ARG_INFO(0, date)
> ZEND_END_ARG_INFO()
>
> ZEND_BEGIN_ARG_INFO_EX(arginfo_imap_num_msg, 0, 0, 1)
> @@ -1270,20 +1272,43 @@
> PHP_FUNCTION(imap_append)
> {
>         zval *streamind;
> -        char *folder, *message, *flags = NULL;
> -        int folder_len, message_len, flags_len = 0;
> +        char *folder, *message, *date = NULL, *flags = NULL;
> +        int folder_len, message_len, date_len = 0, flags_len = 0;
>         pils *imap_le_struct;
>         STRING st;
>
> -        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|s",&streamind,&folder,&folder_len,&message,&message_len,&flags,&flags_len) == FAILURE) {
> +        if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rss|ss",&streamind,&folder,&folder_len,&message,&message_len,&flags,&flags_len,&date,&date_len) == FAILURE) {
>                 return;
>         }
>
> +        char* regex = "/[ 0-3][0-9]-((Jan)|(Feb)|(Mar)|(Apr)|(May)|(Jun)|(Jul)|(Aug)|(Sep)|(Oct)|(Nov)|(Dec))-[0-9]{4} [0-2][0-9]:[0-5][0-9]:[0-5][0-9] [+-][0-9]{4}/";
> +        int regex_len = strlen(regex);
> +        pcre_cache_entry *pce;                                //Compiled regex
> +        zval *subpats = NULL;                                //Parts (not used)
> +        long regex_flags = 0;                                //Flags (not used)
> +        long start_offset = 0;                                //Start offset (not used)
> +        int global = 0;
> +
> +        if (date) {
> +                //Make sure the given date string matches the RFC specified format
> +                if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
> +                        RETURN_FALSE;
> +                }
> +
> +                php_pcre_match_impl(pce, date, date_len, return_value, subpats, global,
> +                        0, regex_flags, start_offset TSRMLS_CC);
> +
> +                if (!Z_LVAL_P(return_value)) {
> +                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "internal date not correctly formatted");
> +                        date = NULL;
> +                }
> +        }
> +
>         ZEND_FETCH_RESOURCE(imap_le_struct, pils *,&streamind, -1, "imap", le_imap);
>
>         INIT (&st, mail_string, (void *) message, message_len);
>
> -        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), NIL,&st)) {
> +        if (mail_append_full(imap_le_struct->imap_stream, folder, (flags ? flags : NIL), (date ? date : NIL),&st)) {
>                 RETURN_TRUE;
>         } else {
>                 RETURN_FALSE;
>
>
>
> Thanks,
>
> - Nick Fortenberry

---

## #45858 — Jani Taskinen — 2009-10-21T16:44:21+00:00

URL: https://externals.io/message/45847#45858 · In reply to: #45856

1. Top-posting is considered evil.
2. Look harder, timelib_* has several functions for this, be creative..
3. Tabs instead of spaces, NO C++ comments!

--Jani



> Hey Jani,
>
> We looked through the date library but it doesn't look like there are any functions to verify that a date is in a certain format.  Unless we are mistaken, it looks like the only way to verify this would be to use a regex.
>
> Also, we read through CODING_STANDARDS and it said to be generous with whitespace and brackets.  Were you referring to something in particular with regards to whitespace?
>
> Thanks,
> Nick
>
>
> -----Original Message-----
> From: "Jani Taskinen"<jani.taskinen@iki.fi>
> Sent: Wednesday, October 21, 2009 2:55am
> To: "Nick Fortenberry"<nick@mailtrust.com>
> Cc: internals@lists.php.net
> Subject: Re: [PHP-DEV] Patch: Add INTERNALDATE to imap_append()
>
> 
> > […]
>
> There are several problems with it. Whitespace and C++ comments being
> the least. :) We have ext/date which is always there, I suggest you use
> those functions to handle dates instead of flaky regexps.
>
> --Jani
>
> > […]

---

## #45860 — Pierre Joye — 2009-10-21T17:54:27+00:00

URL: https://externals.io/message/45847#45860 · In reply to: #45858

> 1. Top-posting is considered evil.
> 2. Look harder, timelib_* has several functions for this, be creative..
> 3. Tabs instead of spaces, NO C++ comments!

4. point him to the right function then.

That would spare us time and bandwidth.

Cheers,
-- 
Pierre

http://blog.thepimp.net | http://www.libgd.org

---

## #45861 — Nick Fortenberry — 2009-10-21T21:07:03+00:00

URL: https://externals.io/message/45847#45861 · In reply to: #45860

-----Original Message-----
>From: "Pierre Joye" <pierre.php@gmail.com>
>Sent: Wednesday, October 21, 2009 1:54pm
>To: jani.taskinen@iki.fi
>Cc: "Nick Fortenberry" <nick@mailtrust.com>, internals@lists.php.net, "Jake Levitt" ><jake.levitt@mailtrust.com>
>Subject: Re: [PHP-DEV] Patch: Add INTERNALDATE to imap_append()
>
>
> > […]
>
>4. point him to the right function then.
>
>That would spare us time and bandwidth.
>
>Cheers,
>-- 
>Pierre


Hey Guys,

We have been looking through the timelib library and the only function that we found that would do something similar to what we want is timelib_parse_from_format().  However, this still will not work completely; it is not strict enough.  Is there any particular reason that you don't want to use a regex?  Using the regex allows the function to make sure the internal date is in an imap date format (date-time = DQUOTE date-day-fixed "-" date-month "-" date-year SP time SP zone DQUOTE).  We're not trying to convert invalid dates into the correct format.

Thanks,
Nick
