iliaa           Tue Jan 13 21:29:45 2009 UTC

  Modified files:              
    /php-src/ext/standard       basic_functions.c mail.c 
  Log:
  
  MFB:Fixed a bug inside mail() logging code that prevents log file from
  existing outside of open_basedir
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/basic_functions.c?r1=1.946&r2=1.947&diff_format=u
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.946 
php-src/ext/standard/basic_functions.c:1.947
--- php-src/ext/standard/basic_functions.c:1.946        Tue Jan  6 20:44:56 2009
+++ php-src/ext/standard/basic_functions.c      Tue Jan 13 21:29:45 2009
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: basic_functions.c,v 1.946 2009/01/06 20:44:56 pajoye Exp $ */
+/* $Id: basic_functions.c,v 1.947 2009/01/13 21:29:45 iliaa Exp $ */
 
 #include "php.h"
 #include "php_streams.h"
@@ -5385,6 +5385,7 @@
                if (_CHECK_PATH(varname, varname_len, "error_log") ||
                        _CHECK_PATH(varname, varname_len, "java.class.path") ||
                        _CHECK_PATH(varname, varname_len, "java.home") ||
+                       _CHECK_PATH(varname, varname_len, "mail.log") ||
                        _CHECK_PATH(varname, varname_len, "java.library.path") 
||
                        _CHECK_PATH(varname, varname_len, 
"vpopmail.directory")) {
 
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.103&r2=1.104&diff_format=u
Index: php-src/ext/standard/mail.c
diff -u php-src/ext/standard/mail.c:1.103 php-src/ext/standard/mail.c:1.104
--- php-src/ext/standard/mail.c:1.103   Fri Jan  9 18:23:45 2009
+++ php-src/ext/standard/mail.c Tue Jan 13 21:29:45 2009
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: mail.c,v 1.103 2009/01/09 18:23:45 tony2001 Exp $ */
+/* $Id: mail.c,v 1.104 2009/01/13 21:29:45 iliaa Exp $ */
 
 #include <stdlib.h>
 #include <ctype.h>
@@ -212,6 +212,8 @@
        if (mail_log) {
                char *tmp;
                int l = spprintf(&tmp, 0, "mail() on [%s:%d]: To: %s -- 
Headers: %s\n", zend_get_executed_filename(TSRMLS_C), 
zend_get_executed_lineno(TSRMLS_C), to, hdr ? hdr : "");
+               php_stream *stream = php_stream_open_wrapper(mail_log, "a", 
IGNORE_URL_WIN | REPORT_ERRORS | STREAM_DISABLE_OPEN_BASEDIR, NULL);
+
                if (hdr) { /* find all \r\n instances and replace them with 
spaces, so a log line is always one line long */ 
                        char *p = tmp;
                        while ((p = strpbrk(p, "\r\n"))) {
@@ -219,7 +221,10 @@
                        }
                        tmp[l - 1] = '\n';
                }
-               _php_error_log(3, tmp, mail_log, NULL TSRMLS_CC);
+               if (stream) {
+                       php_stream_write(stream, tmp, l);
+                       php_stream_close(stream);
+               }
                efree(tmp);
        }
        if (PG(mail_x_header)) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to