[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard proc_open.c /ext/standard/tests/general_functions bug39322.phpt proc_open02.phpt
nlopess Wed Feb 14 19:13:31 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/standard/tests/general_functions bug39322.phpt proc_open02.phpt Modified files: /php-srcNEWS /php-src/ext/standard proc_open.c Log: Fixed bug #39322 (proc_terminate() destroys process resource) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.537r2=1.2027.2.547.2.538diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.537 php-src/NEWS:1.2027.2.547.2.538 --- php-src/NEWS:1.2027.2.547.2.537 Tue Feb 13 19:53:42 2007 +++ php-src/NEWSWed Feb 14 19:13:31 2007 @@ -16,6 +16,7 @@ - Fixed bug #40410 (ext/posix does not compile on MacOS 10.3.9). (Tony) - Fixed bug #40109 (iptcembed fails on non-jfif jpegs). (Tony) - Fixed bug #39836 (SplObjectStorage empty after unserialize). (Marcus) +- Fixed bug #39322 (proc_terminate() destroys process resource). (Nuno) - Fixed bug #37799 (ftp_ssl_connect() falls back to non-ssl connection). (Nuno) - Fixed bug #34794 (proc_close() hangs when used with two processes). (jdolecek at netbsd dot org, Nuno) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.10r2=1.36.2.1.2.11diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.10 php-src/ext/standard/proc_open.c:1.36.2.1.2.11 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.10 Tue Feb 13 19:53:42 2007 +++ php-src/ext/standard/proc_open.cWed Feb 14 19:13:31 2007 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.10 2007/02/13 19:53:42 nlopess Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.11 2007/02/14 19:13:31 nlopess Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -300,7 +300,7 @@ } /* }}} */ -/* {{{ proto int proc_terminate(resource process [, long signal]) +/* {{{ proto bool proc_terminate(resource process [, long signal]) kill a process opened by proc_open */ PHP_FUNCTION(proc_terminate) { @@ -315,13 +315,18 @@ ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, zproc, -1, process, le_proc_open); #ifdef PHP_WIN32 - TerminateProcess(proc-childHandle, 255); + if (TerminateProcess(proc-childHandle, 255)) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } #else - kill(proc-child, sig_no); + if (kill(proc-child, sig_no) == 0) { + RETURN_TRUE; + } else { + RETURN_FALSE; + } #endif - - zend_list_delete(Z_LVAL_P(zproc)); - RETURN_LONG(FG(pclose_ret)); } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/bug39322.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/general_functions/bug39322.phpt +++ php-src/ext/standard/tests/general_functions/bug39322.phpt http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/proc_open02.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/general_functions/proc_open02.phpt +++ php-src/ext/standard/tests/general_functions/proc_open02.phpt -- 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 proc_open.c
tony2001Tue Feb 13 15:55:45 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/ext/standard proc_open.c Log: fix #40455 (proc_open() uses wrong commandline when safe_mode_exec_dir is set) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.534r2=1.2027.2.547.2.535diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.534 php-src/NEWS:1.2027.2.547.2.535 --- php-src/NEWS:1.2027.2.547.2.534 Tue Feb 13 02:16:22 2007 +++ php-src/NEWSTue Feb 13 15:55:45 2007 @@ -5,9 +5,13 @@ - Upgraded PCRE to version 7.0 (Nuno) - Add --ri switch to CLI which allows to check extension information. (Marcus) - Added tidyNode::getParent() method (John, Nuno) +- Fixed bug #40455 (proc_open() uses wrong commandline when safe_mode_exec_dir + is set). (Tony) - Fixed bug #40432 (strip_tags() fails with greater than in attribute). (Ilia) - Fixed bug #40431 (dynamic properties may cause crash in ReflectionProperty methods). (Tony) +- Fixed bug #40451 (addAttribute() may crash when used with non-existent child + node). (Tony) - Fixed bug #40428 (imagepstext() doesn't accept optional parameter). (Pierre) - Fixed bug #40410 (ext/posix does not compile on MacOS 10.3.9). (Tony) - Fixed bug #40109 (iptcembed fails on non-jfif jpegs). (Tony) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.8r2=1.36.2.1.2.9diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.8 php-src/ext/standard/proc_open.c:1.36.2.1.2.9 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.8 Tue Jan 9 16:27:17 2007 +++ php-src/ext/standard/proc_open.cTue Feb 13 15:55:45 2007 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.8 2007/01/09 16:27:17 dmitry Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.9 2007/02/13 15:55:45 tony2001 Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -276,7 +276,7 @@ sep = zend_memrchr(arg0, PHP_DIR_SEPARATOR, larg0); - spprintf(safecmd, 0, %s%c%s%s, PG(safe_mode_exec_dir), (sep ? *sep : '/'), (sep ? : arg0), (space ? cmd + larg0 : )); + spprintf(safecmd, 0, %s%s%s%s, PG(safe_mode_exec_dir), (sep ? sep : /), (sep ? : arg0), (space ? cmd + larg0 : )); efree(arg0); arg0 = php_escape_shell_cmd(*safecmd); -- 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 proc_open.c /ext/standard/tests/general_functions bug34794.phpt
nlopess Tue Feb 13 19:53:42 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/standard/tests/general_functions bug34794.phpt Modified files: /php-srcNEWS /php-src/ext/standard proc_open.c Log: Fixed bug #34794 (proc_close() hangs when used with two processes) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.536r2=1.2027.2.547.2.537diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.536 php-src/NEWS:1.2027.2.547.2.537 --- php-src/NEWS:1.2027.2.547.2.536 Tue Feb 13 18:29:10 2007 +++ php-src/NEWSTue Feb 13 19:53:42 2007 @@ -17,6 +17,8 @@ - Fixed bug #40109 (iptcembed fails on non-jfif jpegs). (Tony) - Fixed bug #39836 (SplObjectStorage empty after unserialize). (Marcus) - Fixed bug #37799 (ftp_ssl_connect() falls back to non-ssl connection). (Nuno) +- Fixed bug #34794 (proc_close() hangs when used with two processes). + (jdolecek at netbsd dot org, Nuno) 08 Feb 2007, PHP 5.2.1 - Added read-timeout context option timeout for HTTP streams. (Hannes, Ilia). http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.9r2=1.36.2.1.2.10diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.9 php-src/ext/standard/proc_open.c:1.36.2.1.2.10 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.9 Tue Feb 13 15:55:45 2007 +++ php-src/ext/standard/proc_open.cTue Feb 13 19:53:42 2007 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.9 2007/02/13 15:55:45 tony2001 Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.10 2007/02/13 19:53:42 nlopess Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -943,6 +943,10 @@ descriptors[i].mode_flags), mode_string, NULL); #else stream = php_stream_fopen_from_fd(descriptors[i].parentend, mode_string, NULL); +# if defined(F_SETFD) defined(FD_CLOEXEC) + /* mark the descriptor close-on-exec, so that it won't be inherited by potential other children */ + fcntl(descriptors[i].parentend, F_SETFD, FD_CLOEXEC); +# endif #endif if (stream) { zval *retfp; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/bug34794.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/general_functions/bug34794.phpt +++ php-src/ext/standard/tests/general_functions/bug34794.phpt -- 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 proc_open.c
dmitry Sat Jan 6 09:02:02 2007 UTC Modified files: (Branch: PHP_5_2) /php-srcNEWS /php-src/ext/standard proc_open.c Log: Improved proc_open(). Now on Windows it can run external commands not through CMD.EXE http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.473r2=1.2027.2.547.2.474diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.473 php-src/NEWS:1.2027.2.547.2.474 --- php-src/NEWS:1.2027.2.547.2.473 Thu Jan 4 23:55:56 2007 +++ php-src/NEWSSat Jan 6 09:02:02 2007 @@ -1,6 +1,8 @@ PHPNEWS ||| ?? Jan 2007, PHP 5.2.1RC3 +- Improved proc_open(). Now on Windows it can run external commands not through + CMD.EXE. (Dmitry) 04 Jan 2007, PHP 5.2.1RC2 - Small optimization of the date() function (Matt,Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.6r2=1.36.2.1.2.7diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.6 php-src/ext/standard/proc_open.c:1.36.2.1.2.7 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.6 Tue Jan 2 15:29:09 2007 +++ php-src/ext/standard/proc_open.cSat Jan 6 09:02:02 2007 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.6 2007/01/02 15:29:09 nlopess Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.7 2007/01/06 09:02:02 dmitry Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -489,6 +489,7 @@ int is_persistent = 0; /* TODO: ensure that persistent procs will work */ #ifdef PHP_WIN32 int suppress_errors = 0; + int bypass_shell = 0; #endif #if PHP_CAN_DO_PTS php_file_descriptor_t dev_ptmx = -1;/* master */ @@ -509,10 +510,17 @@ if (other_options) { zval **item; if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), suppress_errors, sizeof(suppress_errors), (void**)item)) { - if (Z_TYPE_PP(item) == IS_BOOL Z_BVAL_PP(item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) + Z_LVAL_PP(item)) { suppress_errors = 1; } } + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), bypass_shell, sizeof(bypass_shell), (void**)item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) + Z_LVAL_PP(item)) { + bypass_shell = 1; + } + } } #endif @@ -727,21 +735,25 @@ memset(pi, 0, sizeof(pi)); - command_with_cmd = emalloc(command_len + sizeof(COMSPEC_9X) + 1 + sizeof( /c )); - sprintf(command_with_cmd, %s /c %s, GetVersion() 0x8000 ? COMSPEC_NT : COMSPEC_9X, command); - if (suppress_errors) { old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX); } - newprocok = CreateProcess(NULL, command_with_cmd, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + if (bypass_shell) { + newprocok = CreateProcess(NULL, command, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + } else { + command_with_cmd = emalloc(command_len + sizeof(COMSPEC_9X) + 1 + sizeof( /c )); + sprintf(command_with_cmd, %s /c %s, GetVersion() 0x8000 ? COMSPEC_NT : COMSPEC_9X, command); + + newprocok = CreateProcess(NULL, command_with_cmd, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + + efree(command_with_cmd); + } if (suppress_errors) { SetErrorMode(old_error_mode); } - efree(command_with_cmd); - if (FALSE == newprocok) { php_error_docref(NULL TSRMLS_CC, E_WARNING, CreateProcess failed); goto exit_fail; -- 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_2) / NEWS /ext/standard proc_open.c
Uhm, maybe we can also apply this to unix code (skip 'sh')? - Original Message - From: Dmitry Stogov [EMAIL PROTECTED] To: php-cvs@lists.php.net Sent: Saturday, January 06, 2007 9:02 AM Subject: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard proc_open.c dmitry Sat Jan 6 09:02:02 2007 UTC Modified files: (Branch: PHP_5_2) /php-src NEWS /php-src/ext/standard proc_open.c Log: Improved proc_open(). Now on Windows it can run external commands not through CMD.EXE http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.473r2=1.2027.2.547.2.474diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.473 php-src/NEWS:1.2027.2.547.2.474 --- php-src/NEWS:1.2027.2.547.2.473 Thu Jan 4 23:55:56 2007 +++ php-src/NEWS Sat Jan 6 09:02:02 2007 @@ -1,6 +1,8 @@ PHP NEWS ||| ?? Jan 2007, PHP 5.2.1RC3 +- Improved proc_open(). Now on Windows it can run external commands not through + CMD.EXE. (Dmitry) 04 Jan 2007, PHP 5.2.1RC2 - Small optimization of the date() function (Matt,Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.6r2=1.36.2.1.2.7diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.6 php-src/ext/standard/proc_open.c:1.36.2.1.2.7 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.6 Tue Jan 2 15:29:09 2007 +++ php-src/ext/standard/proc_open.c Sat Jan 6 09:02:02 2007 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.6 2007/01/02 15:29:09 nlopess Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.7 2007/01/06 09:02:02 dmitry Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -489,6 +489,7 @@ int is_persistent = 0; /* TODO: ensure that persistent procs will work */ #ifdef PHP_WIN32 int suppress_errors = 0; + int bypass_shell = 0; #endif #if PHP_CAN_DO_PTS php_file_descriptor_t dev_ptmx = -1; /* master */ @@ -509,10 +510,17 @@ if (other_options) { zval **item; if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), suppress_errors, sizeof(suppress_errors), (void**)item)) { - if (Z_TYPE_PP(item) == IS_BOOL Z_BVAL_PP(item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) + Z_LVAL_PP(item)) { suppress_errors = 1; } } + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), bypass_shell, sizeof(bypass_shell), (void**)item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) + Z_LVAL_PP(item)) { + bypass_shell = 1; + } + } } #endif @@ -727,21 +735,25 @@ memset(pi, 0, sizeof(pi)); - command_with_cmd = emalloc(command_len + sizeof(COMSPEC_9X) + 1 + sizeof( /c )); - sprintf(command_with_cmd, %s /c %s, GetVersion() 0x8000 ? COMSPEC_NT : COMSPEC_9X, command); - if (suppress_errors) { old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX); } - newprocok = CreateProcess(NULL, command_with_cmd, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + if (bypass_shell) { + newprocok = CreateProcess(NULL, command, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + } else { + command_with_cmd = emalloc(command_len + sizeof(COMSPEC_9X) + 1 + sizeof( /c )); + sprintf(command_with_cmd, %s /c %s, GetVersion() 0x8000 ? COMSPEC_NT : COMSPEC_9X, command); + + newprocok = CreateProcess(NULL, command_with_cmd, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + + efree(command_with_cmd); + } if (suppress_errors) { SetErrorMode(old_error_mode); } - efree(command_with_cmd); - if (FALSE == newprocok) { php_error_docref(NULL TSRMLS_CC, E_WARNING, CreateProcess failed); goto exit_fail; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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_2) / NEWS /ext/standard proc_open.c
May be it make sense. I thought about it today, but I am afraid to introduce new bugs in last minute. (this is not a simple addition). May be we will return to it after 5.2.1 release. Thanks. Dmitry. -Original Message- From: Nuno Lopes [mailto:[EMAIL PROTECTED] Sent: Saturday, January 06, 2007 7:48 PM To: Dmitry Stogov; php-cvs@lists.php.net Subject: Re: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard proc_open.c Uhm, maybe we can also apply this to unix code (skip 'sh')? - Original Message - From: Dmitry Stogov [EMAIL PROTECTED] To: php-cvs@lists.php.net Sent: Saturday, January 06, 2007 9:02 AM Subject: [PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/standard proc_open.c dmitry Sat Jan 6 09:02:02 2007 UTC Modified files: (Branch: PHP_5_2) /php-src NEWS /php-src/ext/standard proc_open.c Log: Improved proc_open(). Now on Windows it can run external commands not through CMD.EXE http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.473r2=1. 2027.2.547.2.474diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.473 php-src/NEWS:1.2027.2.547.2.474 --- php-src/NEWS:1.2027.2.547.2.473 Thu Jan 4 23:55:56 2007 +++ php-src/NEWS Sat Jan 6 09:02:02 2007 @@ -1,6 +1,8 @@ PHP NEWS || | ?? Jan 2007, PHP 5.2.1RC3 +- Improved proc_open(). Now on Windows it can run external commands +not through + CMD.EXE. (Dmitry) 04 Jan 2007, PHP 5.2.1RC2 - Small optimization of the date() function (Matt,Ilia) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36 .2.1.2.6r2=1.36.2.1.2.7diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.6 php-src/ext/standard/proc_open.c:1.36.2.1.2.7 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.6 Tue Jan 2 15:29:09 2007 +++ php-src/ext/standard/proc_open.c Sat Jan 6 09:02:02 2007 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +- -+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.6 2007/01/02 15:29:09 nlopess Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.7 2007/01/06 09:02:02 dmitry Exp $ +*/ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -489,6 +489,7 @@ int is_persistent = 0; /* TODO: ensure that persistent procs will work */ #ifdef PHP_WIN32 int suppress_errors = 0; + int bypass_shell = 0; #endif #if PHP_CAN_DO_PTS php_file_descriptor_t dev_ptmx = -1; /* master */ @@ -509,10 +510,17 @@ if (other_options) { zval **item; if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), suppress_errors, sizeof(suppress_errors), (void**)item)) { - if (Z_TYPE_PP(item) == IS_BOOL Z_BVAL_PP(item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) + Z_LVAL_PP(item)) { suppress_errors = 1; } } + if (SUCCESS == zend_hash_find(Z_ARRVAL_P(other_options), + bypass_shell, sizeof(bypass_shell), (void**)item)) { + if ((Z_TYPE_PP(item) == IS_BOOL || Z_TYPE_PP(item) == IS_LONG) + Z_LVAL_PP(item)) { + bypass_shell = 1; + } + } } #endif @@ -727,21 +735,25 @@ memset(pi, 0, sizeof(pi)); - command_with_cmd = emalloc(command_len + sizeof(COMSPEC_9X) + 1 + sizeof( /c )); - sprintf(command_with_cmd, %s /c %s, GetVersion() 0x8000 ? COMSPEC_NT : COMSPEC_9X, command); - if (suppress_errors) { old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS|SEM_NOGPFAULTERRORBOX); } - newprocok = CreateProcess(NULL, command_with_cmd, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + if (bypass_shell) { + newprocok = CreateProcess(NULL, command, security, security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + } else { + command_with_cmd = emalloc(command_len + sizeof(COMSPEC_9X) + 1 + sizeof( /c )); + sprintf(command_with_cmd, %s /c %s, GetVersion() 0x8000 ? COMSPEC_NT : COMSPEC_9X, command); + + newprocok = CreateProcess(NULL, command_with_cmd, security, + security, TRUE, NORMAL_PRIORITY_CLASS, env.envp, cwd, si, pi); + + efree(command_with_cmd); + } if (suppress_errors) { SetErrorMode(old_error_mode); } - efree(command_with_cmd); - if (FALSE == newprocok) { php_error_docref(NULL TSRMLS_CC, E_WARNING, CreateProcess failed); goto exit_fail; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- 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 proc_open.c
nlopess Tue Jan 2 15:29:09 2007 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard proc_open.c /php-srcNEWS Log: +- Fixed bug #37619 (proc_open() closes stdin on fork() failure). http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.5r2=1.36.2.1.2.6diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.5 php-src/ext/standard/proc_open.c:1.36.2.1.2.6 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.5 Mon Jan 1 09:36:08 2007 +++ php-src/ext/standard/proc_open.cTue Jan 2 15:29:09 2007 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.5 2007/01/01 09:36:08 sebastian Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.6 2007/01/02 15:29:09 nlopess Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -625,8 +625,6 @@ descriptors[ndesc].mode_flags |= O_BINARY; #endif - - } else if (strcmp(Z_STRVAL_PP(ztype), file) == 0) { zval **zfile, **zmode; int fd; @@ -788,7 +786,8 @@ /* clean up all the descriptors */ for (i = 0; i ndesc; i++) { close(descriptors[i].childend); - close(descriptors[i].parentend); + if (descriptors[i].parentend) + close(descriptors[i].parentend); } php_error_docref(NULL TSRMLS_CC, E_WARNING, procve failed - %s, strerror(errno)); goto exit_fail; @@ -855,7 +854,8 @@ /* clean up all the descriptors */ for (i = 0; i ndesc; i++) { close(descriptors[i].childend); - close(descriptors[i].parentend); + if (descriptors[i].parentend) + close(descriptors[i].parentend); } php_error_docref(NULL TSRMLS_CC, E_WARNING, fork failed - %s, strerror(errno)); http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.468r2=1.2027.2.547.2.469diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.468 php-src/NEWS:1.2027.2.547.2.469 --- php-src/NEWS:1.2027.2.547.2.468 Sun Dec 31 19:22:01 2006 +++ php-src/NEWSTue Jan 2 15:29:09 2007 @@ -51,6 +51,8 @@ - Fixed bugs #39361 #39400 (mbstring function overloading problem). (Seiji) - Fixed bug #38852 (XML-RPC Breaks iconv). (Hannes) - Fixed bug #38542 (proc_get_status() returns wrong PID on windows). (Nuno) +- Fixed bug #37619 (proc_open() closes stdin on fork() failure). + (jdolecek at NetBSD dot org, Nuno) - Fixed bug #37588 (COM Property propputref converts to PHP function and can't be accesed). (Rob) - Fixed bug #36427 (proc_open() / proc_close() leak handles on windows). -- 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 proc_open.c proc_open.h
nlopess Sun Dec 31 14:47:18 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard proc_open.c proc_open.h /php-srcNEWS Log: Fixed bug #38542 (proc_get_status() returns wrong PID on windows) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.2r2=1.36.2.1.2.3diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.2 php-src/ext/standard/proc_open.c:1.36.2.1.2.3 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.2 Thu Dec 28 15:09:29 2006 +++ php-src/ext/standard/proc_open.cSun Dec 31 14:47:17 2006 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.2 2006/12/28 15:09:29 iliaa Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.3 2006/12/31 14:47:17 nlopess Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -216,10 +216,10 @@ #ifdef PHP_WIN32 - WaitForSingleObject(proc-child, INFINITE); - GetExitCodeProcess(proc-child, wstatus); + WaitForSingleObject(proc-childHandle, INFINITE); + GetExitCodeProcess(proc-childHandle, wstatus); FG(pclose_ret) = wstatus; - CloseHandle(proc-child); + CloseHandle(proc-childHandle); #elif HAVE_SYS_WAIT_H @@ -315,7 +315,7 @@ ZEND_FETCH_RESOURCE(proc, struct php_process_handle *, zproc, -1, process, le_proc_open); #ifdef PHP_WIN32 - TerminateProcess(proc-child, 255); + TerminateProcess(proc-childHandle, 255); #else kill(proc-child, sig_no); #endif @@ -371,7 +371,7 @@ #ifdef PHP_WIN32 - GetExitCodeProcess(proc-child, wstatus); + GetExitCodeProcess(proc-childHandle, wstatus); running = wstatus == STILL_ACTIVE; exitcode == STILL_ACTIVE ? -1 : wstatus; @@ -470,6 +470,7 @@ struct php_proc_open_descriptor_item descriptors[PHP_PROC_OPEN_MAX_DESCRIPTORS]; #ifdef PHP_WIN32 PROCESS_INFORMATION pi; + HANDLE childHandle; STARTUPINFO si; BOOL newprocok; SECURITY_ATTRIBUTES security; @@ -747,7 +748,8 @@ goto exit_fail; } - child = pi.hProcess; + childHandle = pi.hProcess; + child = pi.dwProcessId; CloseHandle(pi.hThread); #elif defined(NETWARE) @@ -870,6 +872,9 @@ proc-command = command; proc-npipes = ndesc; proc-child = child; +#ifdef PHP_WIN32 + proc-childHandle = childHandle; +#endif proc-env = env; if (pipes != NULL) { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.h?r1=1.5.2.1r2=1.5.2.1.2.1diff_format=u Index: php-src/ext/standard/proc_open.h diff -u php-src/ext/standard/proc_open.h:1.5.2.1 php-src/ext/standard/proc_open.h:1.5.2.1.2.1 --- php-src/ext/standard/proc_open.h:1.5.2.1Sun Jan 1 12:50:15 2006 +++ php-src/ext/standard/proc_open.hSun Dec 31 14:47:17 2006 @@ -15,11 +15,11 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.h,v 1.5.2.1 2006/01/01 12:50:15 sniper Exp $ */ +/* $Id: proc_open.h,v 1.5.2.1.2.1 2006/12/31 14:47:17 nlopess Exp $ */ #ifdef PHP_WIN32 typedef HANDLE php_file_descriptor_t; -typedef HANDLE php_process_id_t; +typedef DWORD php_process_id_t; #else typedef int php_file_descriptor_t; typedef pid_t php_process_id_t; @@ -40,6 +40,9 @@ struct php_process_handle { php_process_id_tchild; +#ifdef PHP_WIN32 + HANDLE childHandle; +#endif int npipes; long pipes[PHP_PROC_OPEN_MAX_DESCRIPTORS]; char *command; http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.465r2=1.2027.2.547.2.466diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.465 php-src/NEWS:1.2027.2.547.2.466 --- php-src/NEWS:1.2027.2.547.2.465 Sat Dec 30 15:43:10 2006 +++ php-src/NEWSSun Dec 31 14:47:17 2006 @@ -48,6 +48,7 @@ - Fixed bug #39435 ('foo' instanceof bar gives invalid opcode error). (Sara) - Fixed bugs #39361 #39400 (mbstring function overloading problem). (Seiji) - Fixed bug #38852 (XML-RPC Breaks iconv). (Hannes) +- Fixed bug #38542 (proc_get_status() returns wrong PID on windows). (Nuno) - Fixed bug #37588 (COM Property propputref converts to PHP function and can't be accesed). (Rob) - Fixed bug #36392 (wrong number of decimal digits with %e specifier in -- 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 proc_open.c
nlopess Sun Dec 31 15:27:13 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard proc_open.c /php-srcNEWS Log: - Fixed bug #36427 (proc_open() / proc_close() leak handles on windows). http://cvs.php.net/viewvc.cgi/php-src/ext/standard/proc_open.c?r1=1.36.2.1.2.3r2=1.36.2.1.2.4diff_format=u Index: php-src/ext/standard/proc_open.c diff -u php-src/ext/standard/proc_open.c:1.36.2.1.2.3 php-src/ext/standard/proc_open.c:1.36.2.1.2.4 --- php-src/ext/standard/proc_open.c:1.36.2.1.2.3 Sun Dec 31 14:47:17 2006 +++ php-src/ext/standard/proc_open.cSun Dec 31 15:27:13 2006 @@ -15,7 +15,7 @@ | Author: Wez Furlong [EMAIL PROTECTED] | +--+ */ -/* $Id: proc_open.c,v 1.36.2.1.2.3 2006/12/31 14:47:17 nlopess Exp $ */ +/* $Id: proc_open.c,v 1.36.2.1.2.4 2006/12/31 15:27:13 nlopess Exp $ */ #if 0 (defined(__linux__) || defined(sun) || defined(__IRIX__)) # define _BSD_SOURCE /* linux wants this when XOPEN mode is on */ @@ -660,7 +660,8 @@ } #ifdef PHP_WIN32 - descriptors[ndesc].childend = (HANDLE)_get_osfhandle(fd); + descriptors[ndesc].childend = dup_fd_as_handle(fd); + _close(fd); #else descriptors[ndesc].childend = fd; #endif http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.466r2=1.2027.2.547.2.467diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.466 php-src/NEWS:1.2027.2.547.2.467 --- php-src/NEWS:1.2027.2.547.2.466 Sun Dec 31 14:47:17 2006 +++ php-src/NEWSSun Dec 31 15:27:13 2006 @@ -51,6 +51,8 @@ - Fixed bug #38542 (proc_get_status() returns wrong PID on windows). (Nuno) - Fixed bug #37588 (COM Property propputref converts to PHP function and can't be accesed). (Rob) +- Fixed bug #36427 (proc_open() / proc_close() leak handles on windows). + (jdolecek at NetBSD dot org, Nuno) - Fixed bug #36392 (wrong number of decimal digits with %e specifier in sprintf). (Matt,Ilia) - Fixed bug #33734 (Something strange with COM Object). (Rob) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php