[PHP-CVS] cvs: php-src(PHP_5_3) /ext/msql php_msql.c
felipe Fri Oct 3 17:21:49 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/msql php_msql.c Log: MFH: - Fixed: - Some segfaults when no connection is open - Warning about cfg_get_long (Kalle) - New parameter parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/msql/php_msql.c?r1=1.60.2.4.2.2.2.5&r2=1.60.2.4.2.2.2.6&diff_format=u Index: php-src/ext/msql/php_msql.c diff -u php-src/ext/msql/php_msql.c:1.60.2.4.2.2.2.5 php-src/ext/msql/php_msql.c:1.60.2.4.2.2.2.6 --- php-src/ext/msql/php_msql.c:1.60.2.4.2.2.2.5Sun Jul 20 14:28:41 2008 +++ php-src/ext/msql/php_msql.c Fri Oct 3 17:21:49 2008 @@ -16,13 +16,14 @@ +--+ */ -/* $Id: php_msql.c,v 1.60.2.4.2.2.2.5 2008/07/20 14:28:41 felipe Exp $ */ +/* $Id: php_msql.c,v 1.60.2.4.2.2.2.6 2008/10/03 17:21:49 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" +#include "php_ini.h" #include "php_msql.h" #include "ext/standard/php_standard.h" #include "ext/standard/info.h" @@ -429,12 +430,12 @@ zend_rsrc_list_entry *le; if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", msql_globals.num_links); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", msql_globals.num_links); efree(hashed_details); RETURN_FALSE; } if (msql_globals.max_persistent!=-1 && msql_globals.num_persistent>=msql_globals.max_persistent) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%d)", msql_globals.num_persistent); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%ld)", msql_globals.num_persistent); efree(hashed_details); RETURN_FALSE; } @@ -445,6 +446,7 @@ /* create the link */ if ((msql=msqlConnect(host))==-1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "A link to the server could not be established"); efree(hashed_details); RETURN_FALSE; } @@ -505,7 +507,7 @@ } } if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)",msql_globals.num_links); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", msql_globals.num_links); efree(hashed_details); RETURN_FALSE; } @@ -563,23 +565,16 @@ Close an mSQL connection */ PHP_FUNCTION(msql_close) { - zval *msql_link; - int id; + zval *msql_link = NULL; + int id = -1; int msql; - switch (ZEND_NUM_ARGS()) { - case 0: - id = msql_globals.default_link; - break; - case 1: - if (zend_get_parameters(ht, 1, &msql_link)==FAILURE) { - RETURN_FALSE; - } - id = -1; - break; - default: - WRONG_PARAM_COUNT; - break; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &msql_link) == FAILURE) { + return; + } + + if (ZEND_NUM_ARGS() == 0) { + id = msql_globals.default_link; } ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); @@ -602,34 +597,25 @@ Select an mSQL database */ PHP_FUNCTION(msql_select_db) { - zval *db,*msql_link; - int id; - int msql; + zval *msql_link = NULL; + char *db; + int db_len, msql, id = -1; - switch(ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters(ht, 1, &db)==FAILURE) { - RETURN_FALSE; - } - id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - break; - case 2: - if (zend_get_parameters(ht, 2, &db, &msql_link)==FAILURE) { - RETURN_FALSE; - } - id = -1; - break; - default: - WRONG_PARAM_COUNT; - b
[PHP-CVS] cvs: php-src /ext/msql php_msql.c
felipe Fri Oct 3 17:18:31 2008 UTC Modified files: /php-src/ext/msql php_msql.c Log: - Fixed: - Some segfaults when no connection is open - Warning about cfg_get_long (Kalle) - New parameter parsing API http://cvs.php.net/viewvc.cgi/php-src/ext/msql/php_msql.c?r1=1.72&r2=1.73&diff_format=u Index: php-src/ext/msql/php_msql.c diff -u php-src/ext/msql/php_msql.c:1.72 php-src/ext/msql/php_msql.c:1.73 --- php-src/ext/msql/php_msql.c:1.72Sun Jul 20 14:29:29 2008 +++ php-src/ext/msql/php_msql.c Fri Oct 3 17:18:30 2008 @@ -16,13 +16,14 @@ +--+ */ -/* $Id: php_msql.c,v 1.72 2008/07/20 14:29:29 felipe Exp $ */ +/* $Id: php_msql.c,v 1.73 2008/10/03 17:18:30 felipe Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include "php.h" +#include "php_ini.h" #include "php_msql.h" #include "ext/standard/php_standard.h" #include "ext/standard/info.h" @@ -429,12 +430,12 @@ zend_rsrc_list_entry *le; if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)", msql_globals.num_links); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", msql_globals.num_links); efree(hashed_details); RETURN_FALSE; } if (msql_globals.max_persistent!=-1 && msql_globals.num_persistent>=msql_globals.max_persistent) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%d)", msql_globals.num_persistent); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%ld)", msql_globals.num_persistent); efree(hashed_details); RETURN_FALSE; } @@ -445,6 +446,7 @@ /* create the link */ if ((msql=msqlConnect(host))==-1) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "A link to the server could not be established"); efree(hashed_details); RETURN_FALSE; } @@ -505,7 +507,7 @@ } } if (msql_globals.max_links!=-1 && msql_globals.num_links>=msql_globals.max_links) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%d)",msql_globals.num_links); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open links (%ld)", msql_globals.num_links); efree(hashed_details); RETURN_FALSE; } @@ -563,23 +565,16 @@ Close an mSQL connection */ PHP_FUNCTION(msql_close) { - zval *msql_link; - int id; + zval *msql_link = NULL; + int id = -1; int msql; - switch (ZEND_NUM_ARGS()) { - case 0: - id = msql_globals.default_link; - break; - case 1: - if (zend_get_parameters(ht, 1, &msql_link)==FAILURE) { - RETURN_FALSE; - } - id = -1; - break; - default: - WRONG_PARAM_COUNT; - break; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &msql_link) == FAILURE) { + return; + } + + if (ZEND_NUM_ARGS() == 0) { + id = msql_globals.default_link; } ZEND_FETCH_RESOURCE2(msql, int, &msql_link, id, "mSQL-Link", msql_globals.le_link, msql_globals.le_plink); @@ -602,34 +597,25 @@ Select an mSQL database */ PHP_FUNCTION(msql_select_db) { - zval *db,*msql_link; - int id; - int msql; + zval *msql_link = NULL; + char *db; + int db_len, msql, id = -1; - switch(ZEND_NUM_ARGS()) { - case 1: - if (zend_get_parameters(ht, 1, &db)==FAILURE) { - RETURN_FALSE; - } - id = php_msql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU); - break; - case 2: - if (zend_get_parameters(ht, 2, &db, &msql_link)==FAILURE) { - RETURN_FALSE; - } - id = -1; - break; - default: - WRONG_PARAM_COUNT; - break; + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|r", &db, &db_len, &msql_link) == FAILURE)
[PHP-CVS] cvs: php-src /ext/mysqli mysqli.c
pajoye Fri Oct 3 16:20:57 2008 UTC Modified files: /php-src/ext/mysqli mysqli.c Log: - MFB: Declarations MUST BE done in the beginning of a context http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.135&r2=1.136&diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.135 php-src/ext/mysqli/mysqli.c:1.136 --- php-src/ext/mysqli/mysqli.c:1.135 Fri Sep 19 11:39:53 2008 +++ php-src/ext/mysqli/mysqli.c Fri Oct 3 16:20:56 2008 @@ -17,7 +17,7 @@ | Ulf Wendel <[EMAIL PROTECTED]> | +--+ - $Id: mysqli.c,v 1.135 2008/09/19 11:39:53 andrey Exp $ + $Id: mysqli.c,v 1.136 2008/10/03 16:20:56 pajoye Exp $ */ #ifdef HAVE_CONFIG_H @@ -94,8 +94,8 @@ /* Destructor for mysqli entries in free_links/used_links */ void php_mysqli_dtor_p_elements(void *data) { - TSRMLS_FETCH(); MYSQL *mysql = (MYSQL *) data; + TSRMLS_FETCH(); mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/mysqli mysqli.c
pajoye Fri Oct 3 16:19:49 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mysqli mysqli.c Log: - Declarations MUST BE done in the beginning of a context http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/mysqli.c?r1=1.72.2.16.2.17.2.30&r2=1.72.2.16.2.17.2.31&diff_format=u Index: php-src/ext/mysqli/mysqli.c diff -u php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.30 php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.31 --- php-src/ext/mysqli/mysqli.c:1.72.2.16.2.17.2.30 Mon Sep 15 18:09:20 2008 +++ php-src/ext/mysqli/mysqli.c Fri Oct 3 16:19:49 2008 @@ -17,7 +17,7 @@ | Ulf Wendel <[EMAIL PROTECTED]> | +--+ - $Id: mysqli.c,v 1.72.2.16.2.17.2.30 2008/09/15 18:09:20 andrey Exp $ + $Id: mysqli.c,v 1.72.2.16.2.17.2.31 2008/10/03 16:19:49 pajoye Exp $ */ #ifdef HAVE_CONFIG_H @@ -94,8 +94,8 @@ /* Destructor for mysqli entries in free_links/used_links */ void php_mysqli_dtor_p_elements(void *data) { - TSRMLS_FETCH(); MYSQL *mysql = (MYSQL *) data; + TSRMLS_FETCH(); mysqli_close(mysql, MYSQLI_CLOSE_IMPLICIT); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS
janiFri Oct 3 14:52:52 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS Log: reorder http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1238&r2=1.2027.2.547.2.1239&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1238 php-src/NEWS:1.2027.2.547.2.1239 --- php-src/NEWS:1.2027.2.547.2.1238Fri Oct 3 13:59:32 2008 +++ php-src/NEWSFri Oct 3 14:52:52 2008 @@ -1,8 +1,6 @@ PHPNEWS ||| ?? ??? 2008, PHP 5.2.7 -- Fixed bug #14032 (Mail() always returns false but mail is sent). (Mikko) - - Reverted fix for bug #44197 due to behaviour change in minor version. (Felipe) @@ -139,7 +137,7 @@ (Jani) - Fixed bug #42318 (problem with nm on AIX, not finding object files). (Dmitry) - Fixed bug #41348 (OCI8: allow compilation with Oracle 8.1). (Chris Jones) - +- Fixed bug #14032 (Mail() always returns false but mail is sent). (Mikko) 01 May 2008, PHP 5.2.6 - Fixed two possible crashes inside posix extension (Tony) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c
> That Ilia's comment is bullshit. PHP_5_2 is not "critical fixes only" > branch. It's normal bug fix branch til the day PHP 5.3 is released. We can > reconsider it's status once there is 5.3.1 available. Committed, closed bug and updated NEWS. -- Mikko Koppanen -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard mail.c
mkoppanen Fri Oct 3 13:59:33 2008 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/ext/standard mail.c Log: Adds signal handling around popen/pclose in mail.c. Related information on bugs #8992 and #14032 Original patch by D. Parthey http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1237&r2=1.2027.2.547.2.1238&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1237 php-src/NEWS:1.2027.2.547.2.1238 --- php-src/NEWS:1.2027.2.547.2.1237Thu Oct 2 03:41:24 2008 +++ php-src/NEWSFri Oct 3 13:59:32 2008 @@ -1,6 +1,8 @@ PHPNEWS ||| ?? ??? 2008, PHP 5.2.7 +- Fixed bug #14032 (Mail() always returns false but mail is sent). (Mikko) + - Reverted fix for bug #44197 due to behaviour change in minor version. (Felipe) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.9&r2=1.87.2.1.2.10&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.87.2.1.2.9 php-src/ext/standard/mail.c:1.87.2.1.2.10 --- php-src/ext/standard/mail.c:1.87.2.1.2.9Mon Dec 31 07:20:12 2007 +++ php-src/ext/standard/mail.c Fri Oct 3 13:59:33 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.87.2.1.2.9 2007/12/31 07:20:12 sebastian Exp $ */ +/* $Id: mail.c,v 1.87.2.1.2.10 2008/10/03 13:59:33 mkoppanen Exp $ */ #include #include @@ -31,6 +31,12 @@ #include #endif +#if PHP_SIGCHILD +#if HAVE_SIGNAL_H +#include +#endif +#endif + #include "php_mail.h" #include "php_ini.h" #include "safe_mode.h" @@ -200,6 +206,9 @@ int ret; char *sendmail_path = INI_STR("sendmail_path"); char *sendmail_cmd = NULL; +#if PHP_SIGCHILD + void (*sig_handler)() = NULL; +#endif if (!sendmail_path) { #if (defined PHP_WIN32 || defined NETWARE) @@ -224,6 +233,16 @@ sendmail_cmd = sendmail_path; } +#if PHP_SIGCHILD + /* Set signal handler of SIGCHLD to default to prevent other signal handlers +* from being called and reaping the return code when our child exits. +* The original handler needs to be restored after pclose() */ + sig_handler = (void *)signal(SIGCHLD, SIG_DFL); + if (sig_handler == SIG_ERR) { + sig_handler = NULL; + } +#endif + #ifdef PHP_WIN32 sendmail = popen(sendmail_cmd, "wb"); #else @@ -241,6 +260,13 @@ if (EACCES == errno) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); pclose(sendmail); +#if PHP_SIGCHILD + /* Restore handler in case of error on Windows + Not sure if this applicable on Win but just in case. */ + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } #endif @@ -251,6 +277,12 @@ } fprintf(sendmail, "\n%s\n", message); ret = pclose(sendmail); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + #ifdef PHP_WIN32 if (ret == -1) #else @@ -269,6 +301,11 @@ } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c
Mikko Koppanen wrote: On Fri, Oct 3, 2008 at 2:50 PM, Jani Taskinen <[EMAIL PROTECTED]> wrote: It seems like a perfectly valid bug fix, how about merge to PHP_5_2 too? (and close the bug #14032 too..) I will close the bug and update NEWS file. I am not sure about committing to PHP_5_2 after reading http://news.php.net/php.cvs/53337 That Ilia's comment is bullshit. PHP_5_2 is not "critical fixes only" branch. It's normal bug fix branch til the day PHP 5.3 is released. We can reconsider it's status once there is 5.3.1 available. --Jani -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c
On Fri, Oct 3, 2008 at 2:50 PM, Jani Taskinen <[EMAIL PROTECTED]> wrote: > It seems like a perfectly valid bug fix, how about merge to PHP_5_2 too? > (and close the bug #14032 too..) > > --Jani Hi, I will close the bug and update NEWS file. I am not sure about committing to PHP_5_2 after reading http://news.php.net/php.cvs/53337 -- Mikko Koppanen -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c
It seems like a perfectly valid bug fix, how about merge to PHP_5_2 too? (and close the bug #14032 too..) --Jani Mikko Koppanen wrote: mkoppanen Fri Oct 3 13:32:42 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard mail.c Log: Adds signal handling around popen/pclose in mail.c. Related information on bugs #8992 and #14032 Original patch by D. Parthey http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.3&r2=1.87.2.1.2.7.2.4&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3 php-src/ext/standard/mail.c:1.87.2.1.2.7.2.4 --- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3Mon Dec 31 07:17:15 2007 +++ php-src/ext/standard/mail.c Fri Oct 3 13:32:41 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.87.2.1.2.7.2.3 2007/12/31 07:17:15 sebastian Exp $ */ +/* $Id: mail.c,v 1.87.2.1.2.7.2.4 2008/10/03 13:32:41 mkoppanen Exp $ */ #include #include @@ -31,6 +31,12 @@ #include #endif +#if PHP_SIGCHILD +#if HAVE_SIGNAL_H +#include +#endif +#endif + #include "php_mail.h" #include "php_ini.h" #include "safe_mode.h" @@ -193,6 +199,9 @@ int ret; char *sendmail_path = INI_STR("sendmail_path"); char *sendmail_cmd = NULL; +#if PHP_SIGCHILD + void (*sig_handler)() = NULL; +#endif if (!sendmail_path) { #if (defined PHP_WIN32 || defined NETWARE) @@ -217,6 +226,16 @@ sendmail_cmd = sendmail_path; } +#if PHP_SIGCHILD + /* Set signal handler of SIGCHLD to default to prevent other signal handlers +* from being called and reaping the return code when our child exits. +* The original handler needs to be restored after pclose() */ + sig_handler = (void *)signal(SIGCHLD, SIG_DFL); + if (sig_handler == SIG_ERR) { + sig_handler = NULL; + } +#endif + #ifdef PHP_WIN32 sendmail = popen(sendmail_cmd, "wb"); #else @@ -235,6 +254,13 @@ if (EACCES == errno) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); pclose(sendmail); +#if PHP_SIGCHILD + /* Restore handler in case of error on Windows + Not sure if this applicable on Win but just in case. */ + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } #endif @@ -246,6 +272,12 @@ fprintf(sendmail, "\n%s\n", message); ret = pclose(sendmail); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + #ifdef PHP_WIN32 if (ret == -1) #else @@ -264,6 +296,11 @@ } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_3) /ext/standard mail.c
mkoppanen Fri Oct 3 13:32:42 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard mail.c Log: Adds signal handling around popen/pclose in mail.c. Related information on bugs #8992 and #14032 Original patch by D. Parthey http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.87.2.1.2.7.2.3&r2=1.87.2.1.2.7.2.4&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3 php-src/ext/standard/mail.c:1.87.2.1.2.7.2.4 --- php-src/ext/standard/mail.c:1.87.2.1.2.7.2.3Mon Dec 31 07:17:15 2007 +++ php-src/ext/standard/mail.c Fri Oct 3 13:32:41 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.87.2.1.2.7.2.3 2007/12/31 07:17:15 sebastian Exp $ */ +/* $Id: mail.c,v 1.87.2.1.2.7.2.4 2008/10/03 13:32:41 mkoppanen Exp $ */ #include #include @@ -31,6 +31,12 @@ #include #endif +#if PHP_SIGCHILD +#if HAVE_SIGNAL_H +#include +#endif +#endif + #include "php_mail.h" #include "php_ini.h" #include "safe_mode.h" @@ -193,6 +199,9 @@ int ret; char *sendmail_path = INI_STR("sendmail_path"); char *sendmail_cmd = NULL; +#if PHP_SIGCHILD + void (*sig_handler)() = NULL; +#endif if (!sendmail_path) { #if (defined PHP_WIN32 || defined NETWARE) @@ -217,6 +226,16 @@ sendmail_cmd = sendmail_path; } +#if PHP_SIGCHILD + /* Set signal handler of SIGCHLD to default to prevent other signal handlers +* from being called and reaping the return code when our child exits. +* The original handler needs to be restored after pclose() */ + sig_handler = (void *)signal(SIGCHLD, SIG_DFL); + if (sig_handler == SIG_ERR) { + sig_handler = NULL; + } +#endif + #ifdef PHP_WIN32 sendmail = popen(sendmail_cmd, "wb"); #else @@ -235,6 +254,13 @@ if (EACCES == errno) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); pclose(sendmail); +#if PHP_SIGCHILD + /* Restore handler in case of error on Windows + Not sure if this applicable on Win but just in case. */ + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } #endif @@ -246,6 +272,12 @@ fprintf(sendmail, "\n%s\n", message); ret = pclose(sendmail); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + #ifdef PHP_WIN32 if (ret == -1) #else @@ -264,6 +296,11 @@ } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard mail.c
mkoppanen Fri Oct 3 13:31:21 2008 UTC Modified files: /php-src/ext/standard mail.c Log: Adds signal handling around popen/pclose in mail.c. Related information on bugs #8992 and #14032 Original patch by D. Parthey http://cvs.php.net/viewvc.cgi/php-src/ext/standard/mail.c?r1=1.97&r2=1.98&diff_format=u Index: php-src/ext/standard/mail.c diff -u php-src/ext/standard/mail.c:1.97 php-src/ext/standard/mail.c:1.98 --- php-src/ext/standard/mail.c:1.97Mon Dec 31 07:12:16 2007 +++ php-src/ext/standard/mail.c Fri Oct 3 13:31:21 2008 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: mail.c,v 1.97 2007/12/31 07:12:16 sebastian Exp $ */ +/* $Id: mail.c,v 1.98 2008/10/03 13:31:21 mkoppanen Exp $ */ #include #include @@ -31,6 +31,12 @@ #include #endif +#if PHP_SIGCHILD +#if HAVE_SIGNAL_H +#include +#endif +#endif + #include "php_mail.h" #include "php_ini.h" #include "exec.h" @@ -187,6 +193,9 @@ int ret; char *sendmail_path = INI_STR("sendmail_path"); char *sendmail_cmd = NULL; +#if PHP_SIGCHILD + void (*sig_handler)() = NULL; +#endif if (!sendmail_path) { #if (defined PHP_WIN32 || defined NETWARE) @@ -211,6 +220,16 @@ sendmail_cmd = sendmail_path; } +#if PHP_SIGCHILD + /* Set signal handler of SIGCHLD to default to prevent other signal handlers +* from being called and reaping the return code when our child exits. +* The original handler needs to be restored after pclose() */ + sig_handler = (void *)signal(SIGCHLD, SIG_DFL); + if (sig_handler == SIG_ERR) { + sig_handler = NULL; + } +#endif + #ifdef PHP_WIN32 sendmail = popen(sendmail_cmd, "wb"); #else @@ -229,6 +248,13 @@ if (EACCES == errno) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Permission denied: unable to execute shell to run mail delivery binary '%s'", sendmail_path); pclose(sendmail); +#if PHP_SIGCHILD + /* Restore handler in case of error on Windows + Not sure if this applicable on Win but just in case. */ + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } #endif @@ -240,6 +266,12 @@ fprintf(sendmail, "\n%s\n", message); ret = pclose(sendmail); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif + #ifdef PHP_WIN32 if (ret == -1) #else @@ -258,6 +290,11 @@ } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Could not execute mail delivery program '%s'", sendmail_path); +#if PHP_SIGCHILD + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } +#endif return 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: CVSROOT / avail
derick Fri Oct 3 07:23:10 2008 UTC Modified files: /CVSROOTavail Log: - Give Christian phd karma (requested by Hannes). http://cvs.php.net/viewvc.cgi/CVSROOT/avail?r1=1.1450&r2=1.1451&diff_format=u Index: CVSROOT/avail diff -u CVSROOT/avail:1.1450 CVSROOT/avail:1.1451 --- CVSROOT/avail:1.1450Sat Sep 27 09:40:09 2008 +++ CVSROOT/avail Fri Oct 3 07:23:09 2008 @@ -33,7 +33,7 @@ # Some people only work on PhD (The DocBook [manual] build system) # Those with php-src and/or phpdoc karma already have access to this -avail|loudi|phd +avail|loudi,cweiske|phd # People who work on the Engine - not people with just tests access avail|andi,zeev,andrei,stas,sterling,sascha,derick,sebastian,phanto,jani,hirokawa,fujimoto,rvenkat,sesser,kalowsky,iliaa,hyanantha,georg,wez,edink,helly,hholzgra,imajes,gschlossnagle,moriyoshi,dmitry,jon,pollita,tony2001,johannes,bjori,davidw,nicholsr,wharmby,felipe,robinf,scottmac,nlopess,mattwil,colder,lbarnaud,pajoye|Zend,ZendEngine2,TSRM -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php