]> git.pld-linux.org Git - packages/php.git/blobdiff - php-mail.patch
Update obsoletes list to include php 8.2
[packages/php.git] / php-mail.patch
index 396aff95b9d4b1e39fd9e4d5082342528682f7d8..8066670b4432ac8fe4e09405f0b4d3307fd5857f 100644 (file)
@@ -1,6 +1,6 @@
-diff -urN php-4.2.3.org/ext/standard/mail.c php-4.2.3/ext/standard/mail.c
---- php-4.2.3.org/ext/standard/mail.c  Tue Oct 29 21:35:04 2002
-+++ php-4.2.3/ext/standard/mail.c      Tue Oct 29 21:33:03 2002
+diff -urNp -x '*.orig' php-5.2.17.org/ext/standard/mail.c php-5.2.17/ext/standard/mail.c
+--- php-5.2.17.org/ext/standard/mail.c 2010-07-19 15:38:53.000000000 +0200
++++ php-5.2.17/ext/standard/mail.c     2021-10-23 18:57:39.619791815 +0200
 @@ -21,6 +21,8 @@
  #include <stdlib.h>
  #include <ctype.h>
@@ -9,36 +9,53 @@ diff -urN php-4.2.3.org/ext/standard/mail.c php-4.2.3/ext/standard/mail.c
 +#include <string.h>
  #include "php.h"
  #include "ext/standard/info.h"
- #if !defined(PHP_WIN32)
-@@ -37,6 +39,10 @@
+@@ -42,6 +44,8 @@
+ #include "php_string.h"
  #include "safe_mode.h"
  #include "exec.h"
 +#include "zend_operators.h"
-+
 +#include "zend_globals.h"
-+
- #if HAVE_SENDMAIL
  #ifdef PHP_WIN32
  #include "win32/sendmail.h"
-@@ -166,8 +172,42 @@
-               efree (sendmail_cmd);
+@@ -131,6 +135,18 @@ PHP_FUNCTION(mail)
+               MAIL_ASCIIZ_CHECK(extra_cmd, extra_cmd_len);
+       }
  
-       if (sendmail) {
++    /* search for To: and Subject: headers which should be specified in proper mail() parameters, not in additional headers */
++    if (headers != NULL) {
++        if (strncasecmp(headers, "to:", sizeof("to:") - 1) == 0 || strcasestr(headers, "\nto:")) {
++            php_error_docref(NULL TSRMLS_CC, E_WARNING, "To: headers aren't allowed in the additional_headers parameter. Use $to parameter for that. Mail not sent.");
++            RETURN_FALSE;
++        }
++        if (strncasecmp(headers, "subject:", sizeof("subject:") - 1) == 0 || strcasestr(headers, "\nsubject:")) {
++            php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject: headers aren't allowed in the additional_headers parameter. Use $subject parameter for that. Mail not sent.");
++            RETURN_FALSE;
++        }
++    }
++
+       if (to_len > 0) {
+               to_r = estrndup(to, to_len);
+               for (; to_len; to_len--) {
+@@ -276,8 +292,42 @@ PHPAPI int php_mail(char *to, char *subj
+                       return 0;
+               }
+ #endif
 -              fprintf(sendmail, "To: %s\n", to);
 -              fprintf(sendmail, "Subject: %s\n", subject);
++              TSRMLS_FETCH();
++              
 +              if ((to != NULL) && (strlen(to)!=0)) { 
 +                      fprintf(sendmail, "To: %s\n", to);
 +              }
 +              if ((subject != NULL) && (strlen(subject)!=0)) {
 +                      fprintf(sendmail, "Subject: %s\n", subject);
 +              }
-+
-+              TSRMLS_FETCH();
-+              
++              zend_is_auto_global(ZEND_STRL("_SERVER") TSRMLS_CC);
 +              if (PG(http_globals)[TRACK_VARS_SERVER]) {
 +                      zval **remote_addr, **server_name, **server_port,
-+                              **request_uri, **http_user_agent;
++                              **script_name, **http_user_agent;
 +                      
 +                      if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REMOTE_ADDR", sizeof("REMOTE_ADDR"), (void **) &remote_addr)==SUCCESS) {
 +                              convert_to_string_ex(remote_addr);
@@ -51,9 +68,9 @@ diff -urN php-4.2.3.org/ext/standard/mail.c php-4.2.3/ext/standard/mail.c
 +                                      convert_to_string_ex(server_port);
 +                                      fprintf(sendmail, ":%s", Z_STRVAL_PP(server_port));
 +                              }       
-+                              if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &request_uri)==SUCCESS) {
-+                                      convert_to_string_ex(request_uri);
-+                                      fprintf(sendmail, "%s", Z_STRVAL_PP(request_uri));
++                              if (zend_hash_find(PG(http_globals)[TRACK_VARS_SERVER]->value.ht, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &script_name)==SUCCESS) {
++                                      convert_to_string_ex(script_name);
++                                      fprintf(sendmail, "%s", Z_STRVAL_PP(script_name));
 +                              }
 +                              fprintf(sendmail, "\n");
 +                      }
This page took 0.045151 seconds and 4 git commands to generate.