[PHP-CVS] cvs: php-src /ext/standard exec.c
pajoye Mon Apr 20 06:36:05 2009 UTC Modified files: /php-src/ext/standard exec.c Log: - use the new OB API (and fix build) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.141r2=1.142diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.141 php-src/ext/standard/exec.c:1.142 --- php-src/ext/standard/exec.c:1.141 Sun Apr 19 15:00:11 2009 +++ php-src/ext/standard/exec.c Mon Apr 20 06:36:05 2009 @@ -16,7 +16,7 @@ | Ilia Alshanetsky il...@php.net | +--+ */ -/* $Id: exec.c,v 1.141 2009/04/19 15:00:11 iliaa Exp $ */ +/* $Id: exec.c,v 1.142 2009/04/20 06:36:05 pajoye Exp $ */ #include stdio.h #include php.h @@ -111,8 +111,9 @@ } if (type == 1) { + int ob_level; PHPWRITE(buf, bufl); - if (OG(ob_nesting_level) 1) { + if ((php_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_GET_LEVEL, ob_level TSRMLS_CC) == SUCCESS) ob_level 1) { sapi_flush(TSRMLS_C); } } else if (type == 2) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
iliaa Sun Apr 19 15:00:11 2009 UTC Modified files: /php-src/ext/standard exec.c Log: MFB: Fixed bug #47937 (system() calls sapi_flush() regardless of output buffering) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.140r2=1.141diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.140 php-src/ext/standard/exec.c:1.141 --- php-src/ext/standard/exec.c:1.140 Tue Mar 10 23:39:39 2009 +++ php-src/ext/standard/exec.c Sun Apr 19 15:00:11 2009 @@ -16,7 +16,7 @@ | Ilia Alshanetsky il...@php.net | +--+ */ -/* $Id: exec.c,v 1.140 2009/03/10 23:39:39 helly Exp $ */ +/* $Id: exec.c,v 1.141 2009/04/19 15:00:11 iliaa Exp $ */ #include stdio.h #include php.h @@ -112,7 +112,9 @@ if (type == 1) { PHPWRITE(buf, bufl); - sapi_flush(TSRMLS_C); + if (OG(ob_nesting_level) 1) { + sapi_flush(TSRMLS_C); + } } else if (type == 2) { /* strip trailing whitespaces */ l = bufl; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard exec.c
On 19.04.2009 19:00, Ilia Alshanetsky wrote: if (type == 1) { PHPWRITE(buf, bufl); - sapi_flush(TSRMLS_C); + if (OG(ob_nesting_level) 1) { + sapi_flush(TSRMLS_C); + } ext/standard/exec.c: In function 'php_exec': ext/standard/exec.c:115: error: 'output_globals_id' undeclared (first use in this function) ext/standard/exec.c:115: error: (Each undeclared identifier is reported only once ext/standard/exec.c:115: error: for each function it appears in.) -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard exec.c
ZTS build? Ilia Alshanetsky On 19-Apr-09, at 5:33 PM, Antony Dovgal wrote: On 19.04.2009 19:00, Ilia Alshanetsky wrote: if (type == 1) { PHPWRITE(buf, bufl); - sapi_flush(TSRMLS_C); + if (OG(ob_nesting_level) 1) { + sapi_flush(TSRMLS_C); + } ext/standard/exec.c: In function 'php_exec': ext/standard/exec.c:115: error: 'output_globals_id' undeclared (first use in this function) ext/standard/exec.c:115: error: (Each undeclared identifier is reported only once ext/standard/exec.c:115: error: for each function it appears in.) -- Wbr, Antony Dovgal -- 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 /ext/standard exec.c
On 20.04.2009 01:36, Ilia Alshanetsky wrote: ZTS build? Yup. HEAD with ZTS enabled. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard exec.c
I'll try it tomorrow evening. It seems to work fine for me in 5.2 and 5.3 Ilia Alshanetsky On 19-Apr-09, at 5:37 PM, Antony Dovgal wrote: On 20.04.2009 01:36, Ilia Alshanetsky wrote: ZTS build? Yup. HEAD with ZTS enabled. -- Wbr, Antony Dovgal -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
indeyetsThu Oct 16 12:21:27 2008 UTC Modified files: /php-src/ext/standard exec.c Log: MFB: Fixed compilation warnings: tsrm_ls is not used here (anymore?) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.136r2=1.137diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.136 php-src/ext/standard/exec.c:1.137 --- php-src/ext/standard/exec.c:1.136 Sun Aug 17 15:23:22 2008 +++ php-src/ext/standard/exec.c Thu Oct 16 12:21:27 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.136 2008/08/17 15:23:22 pajoye Exp $ */ +/* $Id: exec.c,v 1.137 2008/10/16 12:21:27 indeyets Exp $ */ #include stdio.h #include php.h @@ -253,8 +253,6 @@ char *cmd; char *p = NULL; size_t estimate = (2 * l) + 1; - - TSRMLS_FETCH(); cmd = safe_emalloc(2, l, 1); @@ -343,7 +341,6 @@ int x, y = 0, l = strlen(str); char *cmd; size_t estimate = (4 * l) + 3; - TSRMLS_FETCH(); cmd = safe_emalloc(4, l, 3); /* worst case */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src /ext/standard exec.c
Hi Alexey, Em Qui, 2008-10-16 às 12:21 +, Alexey Zakhlestin escreveu: indeyets Thu Oct 16 12:21:27 2008 UTC Modified files: /php-src/ext/standard exec.c Log: MFB: Fixed compilation warnings: tsrm_ls is not used here (anymore?) It is used in somes cases. The php_escape_shell_arg and php_escape_shell_cmd uses php_mblen(): #ifndef HAVE_MBLEN # define php_mblen(ptr, len) 1 #else # if defined(_REENTRANT) defined(HAVE_MBRLEN) defined(HAVE_MBSTATE_T) # define php_mblen(ptr, len) ((ptr) == NULL ? mbsinit(BG(mblen_state)): (int)mbrlen(ptr, len, BG(mblen_state))) # else # define php_mblen(ptr, len) mblen(ptr, len) # endif #endif http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.136r2=1.137diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.136 php-src/ext/standard/exec.c:1.137 --- php-src/ext/standard/exec.c:1.136 Sun Aug 17 15:23:22 2008 +++ php-src/ext/standard/exec.c Thu Oct 16 12:21:27 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.136 2008/08/17 15:23:22 pajoye Exp $ */ +/* $Id: exec.c,v 1.137 2008/10/16 12:21:27 indeyets Exp $ */ #include stdio.h #include php.h @@ -253,8 +253,6 @@ char *cmd; char *p = NULL; size_t estimate = (2 * l) + 1; - - TSRMLS_FETCH(); cmd = safe_emalloc(2, l, 1); @@ -343,7 +341,6 @@ int x, y = 0, l = strlen(str); char *cmd; size_t estimate = (4 * l) + 3; - TSRMLS_FETCH(); cmd = safe_emalloc(4, l, 3); /* worst case */ -- Regards, Felipe Pena -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c /ext/standard/tests/general_functions escapeshellcmd-win32.phpt
pajoye Sun Aug 17 15:23:23 2008 UTC Modified files: /php-src/ext/standard exec.c /php-src/ext/standard/tests/general_functions escapeshellcmd-win32.phpt Log: - [DOC] improve fix for #43261 for % and http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.135r2=1.136diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.135 php-src/ext/standard/exec.c:1.136 --- php-src/ext/standard/exec.c:1.135 Tue Jul 22 21:56:25 2008 +++ php-src/ext/standard/exec.c Sun Aug 17 15:23:22 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.135 2008/07/22 21:56:25 scottmac Exp $ */ +/* $Id: exec.c,v 1.136 2008/08/17 15:23:22 pajoye Exp $ */ #include stdio.h #include php.h @@ -272,9 +272,9 @@ } switch (str[x]) { +#ifndef PHP_WIN32 case '': case '\'': -#ifndef PHP_WIN32 if (!p (p = memchr(str + x + 1, str[x], l - x - 1))) { /* noop */ } else if (p *p == str[x]) { @@ -285,7 +285,9 @@ cmd[y++] = str[x]; break; #else - /* This is Windows specific for enviromental variables */ + /* % is Windows specific for enviromental variables, ^%PATH% will + output PATH whil ^%PATH^% not. escapeshellcmd will escape all %. + */ case '%': cmd[y++] = ' '; break; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt diff -u php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt:1.1 php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt:1.2 --- php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt:1.1 Tue Jul 22 16:18:37 2008 +++ php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt Sun Aug 17 15:23:23 2008 @@ -16,7 +16,8 @@ '()[]{}$', '%^', '#;`|*?', - '~\\' + '~\\', + '%NOENV%' ); $count = 1; @@ -38,9 +39,11 @@ -- Test 4 -- string(14) ^(^)^[^]^{^}^$ -- Test 5 -- -string(2) ^^ +string(4) ^%^^ -- Test 6 -- string(14) ^#^^;^`^|^*^? -- Test 7 -- string(8) ^~^^^\ +-- Test 8 -- +string(9) ^%NOENV^% Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c /ext/standard/tests/general_functions escapeshellcmd-win32.phpt
scottmacTue Jul 22 16:18:37 2008 UTC Added files: /php-src/ext/standard/tests/general_functions escapeshellcmd-win32.phpt Modified files: /php-src/ext/standard exec.c Log: Add test for escapeshellcmd and restore previous behaviour with stripping % on Windows. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.133r2=1.134diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.133 php-src/ext/standard/exec.c:1.134 --- php-src/ext/standard/exec.c:1.133 Fri May 30 16:52:06 2008 +++ php-src/ext/standard/exec.c Tue Jul 22 16:18:37 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.133 2008/05/30 16:52:06 scottmac Exp $ */ +/* $Id: exec.c,v 1.134 2008/07/22 16:18:37 scottmac Exp $ */ #include stdio.h #include php.h @@ -284,6 +284,11 @@ } cmd[y++] = str[x]; break; +#else + /* This is Windows specific for enviromental variables */ + case '%': + cmd[y++] = ''; + break; #endif case '#': /* This is character-set independent */ case '': @@ -307,8 +312,6 @@ case '\x0A': /* excluding these two */ case '\xFF': #ifdef PHP_WIN32 - /* This is Windows specific for enviromental variables */ - case '%': cmd[y++] = '^'; #else cmd[y++] = '\\'; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt?view=markuprev=1.1 Index: php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt +++ php-src/ext/standard/tests/general_functions/escapeshellcmd-win32.phpt --TEST-- Test escapeshellcmd() functionality on Windows --SKIPIF-- ?php if( substr(PHP_OS, 0, 3) != 'WIN' ) { die('skip...Valid for Windows only'); } ? --FILE-- ?php echo *** Testing escapeshellcmd() basic operations ***\n; $data = array( 'abc', 'abc, '?', '()[]{}$', '%^', '#;`|*?', '~\\' ); $count = 1; foreach ($data AS $value) { echo -- Test . $count++ . --\n; var_dump(escapeshellcmd($value)); } echo Done\n; ? --EXPECTF-- *** Testing escapeshellcmd() basic operations *** -- Test 1 -- string(5) ^abc -- Test 2 -- string(5) ^'abc -- Test 3 -- string(6) ^?^^ -- Test 4 -- string(14) ^(^)^[^]^{^}^$ -- Test 5 -- string(2) ^^ -- Test 6 -- string(14) ^#^^;^`^|^*^? -- Test 7 -- string(8) ^~^^^\ Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
scottmacTue Jul 22 21:56:25 2008 UTC Modified files: /php-src/ext/standard exec.c Log: MFB: Fix windows build error. http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.134r2=1.135diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.134 php-src/ext/standard/exec.c:1.135 --- php-src/ext/standard/exec.c:1.134 Tue Jul 22 16:18:37 2008 +++ php-src/ext/standard/exec.c Tue Jul 22 21:56:25 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.134 2008/07/22 16:18:37 scottmac Exp $ */ +/* $Id: exec.c,v 1.135 2008/07/22 21:56:25 scottmac Exp $ */ #include stdio.h #include php.h @@ -287,7 +287,7 @@ #else /* This is Windows specific for enviromental variables */ case '%': - cmd[y++] = ''; + cmd[y++] = ' '; break; #endif case '#': /* This is character-set independent */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
scottmacFri May 30 16:52:06 2008 UTC Modified files: /php-src/ext/standard exec.c Log: Fixed bug #43261 (Use ^ as an escape character for Windows escapeshellcmd) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.132r2=1.133diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.132 php-src/ext/standard/exec.c:1.133 --- php-src/ext/standard/exec.c:1.132 Sun Mar 30 12:27:37 2008 +++ php-src/ext/standard/exec.c Fri May 30 16:52:06 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.132 2008/03/30 12:27:37 felipe Exp $ */ +/* $Id: exec.c,v 1.133 2008/05/30 16:52:06 scottmac Exp $ */ #include stdio.h #include php.h @@ -307,12 +307,12 @@ case '\x0A': /* excluding these two */ case '\xFF': #ifdef PHP_WIN32 - /* since Windows does not allow us to escape these chars, just remove them */ + /* This is Windows specific for enviromental variables */ case '%': - cmd[y++] = ' '; - break; -#endif + cmd[y++] = '^'; +#else cmd[y++] = '\\'; +#endif /* fall-through */ default: cmd[y++] = str[x]; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c /sapi/cli/tests bug44564.phpt
felipe Sun Mar 30 12:27:37 2008 UTC Modified files: /php-src/ext/standard exec.c /php-src/sapi/cli/tests bug44564.phpt Log: MFB: Fixed bug #44564 (escapeshellarg removes UTF-8 multi-byte characters) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.131r2=1.132diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.131 php-src/ext/standard/exec.c:1.132 --- php-src/ext/standard/exec.c:1.131 Sat Mar 22 20:37:08 2008 +++ php-src/ext/standard/exec.c Sun Mar 30 12:27:37 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.131 2008/03/22 20:37:08 felipe Exp $ */ +/* $Id: exec.c,v 1.132 2008/03/30 12:27:37 felipe Exp $ */ #include stdio.h #include php.h @@ -265,6 +265,8 @@ if (mb_len 0) { continue; } else if (mb_len 1) { + memcpy(cmd + y, str + x, mb_len); + y += mb_len; x += mb_len - 1; continue; } @@ -353,6 +355,8 @@ if (mb_len 0) { continue; } else if (mb_len 1) { + memcpy(cmd + y, str + x, mb_len); + y += mb_len; x += mb_len - 1; continue; } http://cvs.php.net/viewvc.cgi/php-src/sapi/cli/tests/bug44564.phpt?r1=1.1r2=1.2diff_format=u Index: php-src/sapi/cli/tests/bug44564.phpt diff -u /dev/null php-src/sapi/cli/tests/bug44564.phpt:1.2 --- /dev/null Sun Mar 30 12:27:37 2008 +++ php-src/sapi/cli/tests/bug44564.phptSun Mar 30 12:27:37 2008 @@ -0,0 +1,16 @@ +--TEST-- +Bug #44564 (escapeshellarg removes UTF-8 multi-byte characters) +--FILE-- +?php + +var_dump(escapeshellcmd('f{o}â¬')); +var_dump(escapeshellarg('f~|;*Ã?')); +var_dump(escapeshellcmd('?â¬Â®Äæ?')); +var_dump(escapeshellarg('aÅÅâ¬')); + +? +--EXPECT-- +string(13) f\{o\}\â¬\ +string(10) 'f~|;*Ã?' +string(13) \?â¬Â®Äæ\? +string(10) 'aÅÅâ¬' -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
tony2001Fri Mar 21 08:28:09 2008 UTC Modified files: /php-src/ext/standard exec.c Log: fix ZTS build http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.129r2=1.130diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.129 php-src/ext/standard/exec.c:1.130 --- php-src/ext/standard/exec.c:1.129 Thu Mar 20 23:26:01 2008 +++ php-src/ext/standard/exec.c Fri Mar 21 08:28:09 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.129 2008/03/20 23:26:01 iliaa Exp $ */ +/* $Id: exec.c,v 1.130 2008/03/21 08:28:09 tony2001 Exp $ */ #include stdio.h #include php.h @@ -336,6 +336,7 @@ int x, y = 0, l = strlen(str); char *cmd; size_t estimate = (4 * l) + 3; + TSRMLS_FETCH(); cmd = safe_emalloc(4, l, 3); /* worst case */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
iliaa Thu Mar 20 23:26:01 2008 UTC Modified files: /php-src/ext/standard exec.c Log: MFB: Refine fix for multibyte char hanling inside command names and args http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.128r2=1.129diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.128 php-src/ext/standard/exec.c:1.129 --- php-src/ext/standard/exec.c:1.128 Tue Mar 18 00:32:58 2008 +++ php-src/ext/standard/exec.c Thu Mar 20 23:26:01 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.128 2008/03/18 00:32:58 felipe Exp $ */ +/* $Id: exec.c,v 1.129 2008/03/20 23:26:01 iliaa Exp $ */ #include stdio.h #include php.h @@ -259,8 +259,13 @@ cmd = safe_emalloc(2, l, 1); for (x = 0, y = 0; x l; x++) { + int mb_len = php_mblen(str + x, (l - x)); + /* skip non-valid multibyte characters */ - if (php_mblen(str + x, (l - x)) 0) { + if (mb_len 0) { + continue; + } else if (mb_len 1) { + x += mb_len - 1; continue; } @@ -341,6 +346,16 @@ #endif for (x = 0; x l; x++) { + int mb_len = php_mblen(str + x, (l - x)); + + /* skip non-valid multibyte characters */ + if (mb_len 0) { + continue; + } else if (mb_len 1) { + x += mb_len - 1; + continue; + } + switch (str[x]) { #ifdef PHP_WIN32 case '': -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
felipe Tue Mar 18 00:32:58 2008 UTC Modified files: /php-src/ext/standard exec.c Log: Fix build http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.127r2=1.128diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.127 php-src/ext/standard/exec.c:1.128 --- php-src/ext/standard/exec.c:1.127 Mon Mar 17 23:02:35 2008 +++ php-src/ext/standard/exec.c Tue Mar 18 00:32:58 2008 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.127 2008/03/17 23:02:35 iliaa Exp $ */ +/* $Id: exec.c,v 1.128 2008/03/18 00:32:58 felipe Exp $ */ #include stdio.h #include php.h @@ -24,6 +24,7 @@ #include php_string.h #include ext/standard/head.h #include ext/standard/file.h +#include basic_functions.h #include exec.h #include php_globals.h #include SAPI.h @@ -252,6 +253,8 @@ char *cmd; char *p = NULL; size_t estimate = (2 * l) + 1; + + TSRMLS_FETCH(); cmd = safe_emalloc(2, l, 1); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c exec.h
janiMon Nov 5 14:06:19 2007 UTC Modified files: /php-src/ext/standard exec.c exec.h Log: ws + cs + missing PHPAPIs http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.124r2=1.125diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.124 php-src/ext/standard/exec.c:1.125 --- php-src/ext/standard/exec.c:1.124 Sat Jul 14 08:38:19 2007 +++ php-src/ext/standard/exec.c Mon Nov 5 14:06:19 2007 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.124 2007/07/14 08:38:19 tony2001 Exp $ */ +/* $Id: exec.c,v 1.125 2007/11/05 14:06:19 jani Exp $ */ #include stdio.h #include php.h @@ -57,7 +57,7 @@ * * Unicode command strings are encoding using filesystem_encoding, returned data is not decoded back to unicode */ -int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC) +PHPAPI int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC) { FILE *fp; char *buf; @@ -92,7 +92,7 @@ if (type != 3) { b = buf; - + while (php_stream_get_line(stream, ZSTR(b), EXEC_INPUT_BUF, bufl)) { /* no new line found, let's read some more */ if (b[bufl - 1] != '\n' !php_stream_eof(stream)) { @@ -113,7 +113,7 @@ PHPWRITE(buf, bufl); sapi_flush(TSRMLS_C); } else if (type == 2) { - /* strip trailing whitespaces */ + /* strip trailing whitespaces */ l = bufl; while (l-- isspace(((unsigned char *)buf)[l])); if (l != (bufl - 1)) { @@ -125,7 +125,7 @@ b = buf; } if (bufl) { - /* strip trailing whitespaces if we have not done so already */ + /* strip trailing whitespaces if we have not done so already */ if (type != 2) { l = bufl; while (l-- isspace(((unsigned char *)buf)[l])); @@ -146,7 +146,7 @@ } } - pclose_return = php_stream_close(stream); + pclose_return = php_stream_close(stream); efree(buf); done: @@ -219,7 +219,6 @@ { php_exec_ex(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); } - /* }}} */ /* {{{ proto int system(string command [, int return_value]) U @@ -247,14 +246,15 @@ *NOT* safe for binary strings */ -char *php_escape_shell_cmd(char *str) { +PHPAPI char *php_escape_shell_cmd(char *str) +{ register int x, y, l = strlen(str); char *cmd; char *p = NULL; size_t estimate = (2 * l) + 1; cmd = safe_emalloc(2, l, 1); - + for (x = 0, y = 0; x l; x++) { switch (str[x]) { case '': @@ -318,13 +318,14 @@ /* {{{ php_escape_shell_arg */ -char *php_escape_shell_arg(char *str) { +PHPAPI char *php_escape_shell_arg(char *str) +{ int x, y = 0, l = strlen(str); char *cmd; size_t estimate = (4 * l) + 3; cmd = safe_emalloc(4, l, 3); /* worst case */ - + #ifdef PHP_WIN32 cmd[y++] = ''; #else @@ -415,7 +416,7 @@ RETURN_FALSE; } } - + if (argument) { cmd = php_escape_shell_arg(argument); RETVAL_STRING(cmd, 0); @@ -460,8 +461,8 @@ stream = php_stream_fopen_from_pipe(in, rb); total_readbytes = php_stream_copy_to_mem(stream, ret, PHP_STREAM_COPY_ALL, 0); - php_stream_close(stream); - + php_stream_close(stream); + if (total_readbytes 0) { RETVAL_STRINGL(ret, total_readbytes, 0); } @@ -489,7 +490,7 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, Only a super user may attempt to increase the priority of a process); RETURN_FALSE; } - + RETURN_TRUE; } /* }}} */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.h?r1=1.28r2=1.29diff_format=u Index: php-src/ext/standard/exec.h diff -u php-src/ext/standard/exec.h:1.28 php-src/ext/standard/exec.h:1.29 --- php-src/ext/standard/exec.h:1.28Mon Jan 1 09:29:31 2007 +++ php-src/ext/standard/exec.h Mon Nov 5 14:06:19 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: exec.h,v 1.28 2007/01/01 09:29:31 sebastian Exp $ */ +/* $Id: exec.h,v 1.29 2007/11/05 14:06:19 jani Exp $ */ #ifndef EXEC_H #define EXEC_H @@ -36,6 +36,6 @@ PHPAPI char *php_escape_shell_cmd(char *); PHPAPI
[PHP-CVS] cvs: php-src /ext/standard exec.c file.c filestat.c flock_compat.c fsock.c ftp_fopen_wrapper.c head.c html.c http_fopen_wrapper.c incomplete_class.c info.c lcg.c math.c md5.c metaphone.c mic
tony2001Sat Jul 14 08:38:20 2007 UTC Modified files: /php-src/ext/standard exec.c file.c filestat.c flock_compat.c fsock.c ftp_fopen_wrapper.c head.c html.c http_fopen_wrapper.c incomplete_class.c info.c lcg.c math.c md5.c metaphone.c microtime.c pageinfo.c php_fopen_wrapper.c quot_print.c reg.c sha1.c streamsfuncs.c syslog.c url.c url_scanner.c user_filters.c versioning.c Log: fix ws, cs folding http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.123r2=1.124diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.123 php-src/ext/standard/exec.c:1.124 --- php-src/ext/standard/exec.c:1.123 Mon Jan 1 09:29:31 2007 +++ php-src/ext/standard/exec.c Sat Jul 14 08:38:19 2007 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.123 2007/01/01 09:29:31 sebastian Exp $ */ +/* $Id: exec.c,v 1.124 2007/07/14 08:38:19 tony2001 Exp $ */ #include stdio.h #include php.h @@ -165,7 +165,7 @@ } /* }}} */ -static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) +static void php_exec_ex(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ */ { char *cmd; int cmd_len; @@ -211,6 +211,7 @@ efree(cmd); } } +/* }}} */ /* {{{ proto string exec(string command [, array output [, int return_value]]) U Execute an external program */ http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.494r2=1.495diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.494 php-src/ext/standard/file.c:1.495 --- php-src/ext/standard/file.c:1.494 Tue Jul 10 17:02:43 2007 +++ php-src/ext/standard/file.c Sat Jul 14 08:38:19 2007 @@ -21,7 +21,7 @@ +--+ */ -/* $Id: file.c,v 1.494 2007/07/10 17:02:43 dmitry Exp $ */ +/* $Id: file.c,v 1.495 2007/07/14 08:38:19 tony2001 Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -145,6 +145,7 @@ } /* }}} */ + /* {{{ Module-Stuff */ static ZEND_RSRC_DTOR_FUNC(file_context_dtor) @@ -303,15 +304,14 @@ /* }}} */ -PHP_MSHUTDOWN_FUNCTION(file) +PHP_MSHUTDOWN_FUNCTION(file) /* {{{ */ { #ifndef ZTS file_globals_dtor(file_globals TSRMLS_CC); #endif return SUCCESS; } - - +/* }}} */ /* {{{ proto bool flock(resource fp, int operation [, int wouldblock]) U Portable file locking */ @@ -1876,10 +1876,11 @@ } /* }}} */ -PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC) +PHPAPI int php_copy_file(char *src, char *dest TSRMLS_DC) /* {{{ */ { return php_copy_file_ex(src, dest, 0 TSRMLS_CC); } +/* }}} */ /* {{{ php_copy_file */ @@ -2515,12 +2516,7 @@ #define PHP_FGETCSV_UNI_CHECK(p, e, m, mlen) ((p) (e) (((mlen) == 1 *(p) == *(m)) || ((mlen) 1 (((e) - (p)) = (mlen)) memcmp((p), (m), UBYTES(mlen)) == 0))) /* Unicode mode fgetcsv */ -PHPAPI void php_u_fgetcsv(php_stream *stream, - UChar *delimiter, int delimiter_len, - UChar *enclosure, int enclosure_len, - UChar *escape, int escape_len, - UChar *buffer, int buffer_len, - zval *return_value TSRMLS_DC) +PHPAPI void php_u_fgetcsv(php_stream *stream, UChar *delimiter, int delimiter_len, UChar *enclosure, int enclosure_len, UChar *escape, int escape_len, UChar *buffer, int buffer_len, zval *return_value TSRMLS_DC) /* {{{ */ { php_fgetcsv_state state = PHP_FGETCSV_READY; UChar *p = buffer, *e = buffer + buffer_len, *field_start = NULL, *field_end = NULL; http://cvs.php.net/viewvc.cgi/php-src/ext/standard/filestat.c?r1=1.161r2=1.162diff_format=u Index: php-src/ext/standard/filestat.c diff -u php-src/ext/standard/filestat.c:1.161 php-src/ext/standard/filestat.c:1.162 --- php-src/ext/standard/filestat.c:1.161 Mon Jul 9 18:10:17 2007 +++ php-src/ext/standard/filestat.c Sat Jul 14 08:38:19 2007 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: filestat.c,v 1.161 2007/07/09 18:10:17 tony2001 Exp $ */ +/* $Id: filestat.c,v 1.162 2007/07/14 08:38:19 tony2001 Exp $ */ #include php.h #include fopen_wrappers.h @@ -1038,6 +1038,7 @@ /* }}} */ /* another quickie macro to make defining similar functions easier */ +/* {{{ FileFunction(name, funcnum) */ #define FileFunction(name, funcnum) \ void name(INTERNAL_FUNCTION_PARAMETERS) { \ char *filename; \ @@ -1061,6 +1062,8 @@ } \ } +/* }}} */ + /* {{{ proto int fileperms(string filename) U Get file permissions */
[PHP-CVS] cvs: php-src /ext/standard exec.c
pollita Sun Sep 24 17:03:58 2006 UTC Modified files: /php-src/ext/standard exec.c Log: PHP6 Updates http://cvs.php.net/viewvc.cgi/php-src/ext/standard/exec.c?r1=1.120r2=1.121diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.120 php-src/ext/standard/exec.c:1.121 --- php-src/ext/standard/exec.c:1.120 Sun Jun 11 20:33:29 2006 +++ php-src/ext/standard/exec.c Sun Sep 24 17:03:58 2006 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.120 2006/06/11 20:33:29 bjori Exp $ */ +/* $Id: exec.c,v 1.121 2006/09/24 17:03:58 pollita Exp $ */ #include stdio.h #include php.h @@ -55,6 +55,7 @@ * If type==2, all lines will be saved to given array (exec with $array) * If type==3, output will be printed binary, no lines will be saved or returned (passthru) * + * Unicode command strings are encoding using filesystem_encoding, returned data is not decoded back to unicode */ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC) { @@ -168,15 +169,16 @@ { char *cmd; int cmd_len; + zend_uchar cmd_type; zval *ret_code=NULL, *ret_array=NULL; int ret; if (mode) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z/, cmd, cmd_len, ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|z/, cmd, cmd_len, cmd_type, ret_code) == FAILURE) { RETURN_FALSE; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z/z/, cmd, cmd_len, ret_array, ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, t|z/z/, cmd, cmd_len, cmd_type, ret_array, ret_code) == FAILURE) { RETURN_FALSE; } } @@ -185,6 +187,12 @@ RETURN_FALSE; } + if (cmd_type == IS_UNICODE) { + if (FAILURE == php_stream_path_encode(NULL, cmd, cmd_len, (UChar*)cmd, cmd_len, REPORT_ERRORS, FG(default_context))) { + RETURN_FALSE; + } + } + if (!ret_array) { ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC); } else { @@ -198,9 +206,13 @@ zval_dtor(ret_code); ZVAL_LONG(ret_code, ret); } + + if (cmd_type == IS_UNICODE) { + efree(cmd); + } } -/* {{{ proto string exec(string command [, array output [, int return_value]]) +/* {{{ proto string exec(string command [, array output [, int return_value]]) U Execute an external program */ PHP_FUNCTION(exec) { @@ -209,7 +221,7 @@ /* }}} */ -/* {{{ proto int system(string command [, int return_value]) +/* {{{ proto int system(string command [, int return_value]) U Execute an external program and display output */ PHP_FUNCTION(system) { @@ -217,7 +229,7 @@ } /* }}} */ -/* {{{ proto void passthru(string command [, int return_value]) +/* {{{ proto void passthru(string command [, int return_value]) U Execute an external program and display raw output */ PHP_FUNCTION(passthru) { @@ -235,11 +247,11 @@ *NOT* safe for binary strings */ char *php_escape_shell_cmd(char *str) { - register int x, y, l; + register int x, y, l = strlen(str); char *cmd; char *p = NULL; + size_t estimate = (2 * l) + 1; - l = strlen(str); cmd = safe_emalloc(2, l, 1); for (x = 0, y = 0; x l; x++) { @@ -292,6 +304,13 @@ } } cmd[y] = '\0'; + + if ((estimate - y) 4096) { + /* realloc if the estimate was way overill +* Arbitrary cutoff point of 4096 */ + cmd = erealloc(cmd, y + 1); + } + return cmd; } /* }}} */ @@ -299,12 +318,10 @@ /* {{{ php_escape_shell_arg */ char *php_escape_shell_arg(char *str) { - int x, y, l; + int x, y = 0, l = strlen(str); char *cmd; + size_t estimate = (4 * l) + 3; - y = 0; - l = strlen(str); - cmd = safe_emalloc(4, l, 3); /* worst case */ #ifdef PHP_WIN32 @@ -337,71 +354,106 @@ cmd[y++] = '\''; #endif cmd[y] = '\0'; + + if ((estimate - y) 4096) { + /* realloc if the estimate was way overill +* Arbitrary cutoff point of 4096 */ + cmd = erealloc(cmd, y + 1); + } return cmd; } /* }}} */ -/* {{{ proto string escapeshellcmd(string command) +/* {{{ proto string escapeshellcmd(string command) U Escape shell metacharacters */ PHP_FUNCTION(escapeshellcmd) { - zval **arg1; + char *command; + int command_len; + zend_uchar command_type; char *cmd = NULL; -
[PHP-CVS] cvs: php-src /ext/standard exec.c streamsfuncs.c string.c /ext/zlib zlib.c
bjori Sun Jun 11 20:33:29 2006 UTC Modified files: /php-src/ext/zlib zlib.c /php-src/ext/standard string.c streamsfuncs.c exec.c Log: Nuke unused var http://cvs.php.net/viewcvs.cgi/php-src/ext/zlib/zlib.c?r1=1.196r2=1.197diff_format=u Index: php-src/ext/zlib/zlib.c diff -u php-src/ext/zlib/zlib.c:1.196 php-src/ext/zlib/zlib.c:1.197 --- php-src/ext/zlib/zlib.c:1.196 Sat Jun 3 11:19:44 2006 +++ php-src/ext/zlib/zlib.c Sun Jun 11 20:33:29 2006 @@ -19,7 +19,7 @@ +--+ */ -/* $Id: zlib.c,v 1.196 2006/06/03 11:19:44 mike Exp $ */ +/* $Id: zlib.c,v 1.197 2006/06/11 20:33:29 bjori Exp $ */ #ifdef HAVE_CONFIG_H #include config.h @@ -285,7 +285,7 @@ char *filename; int filename_len; long flags = 0; - char *slashed, buf[8192]; + char buf[8192]; register int i = 0; int use_include_path = 0; php_stream *stream; http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/string.c?r1=1.544r2=1.545diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.544 php-src/ext/standard/string.c:1.545 --- php-src/ext/standard/string.c:1.544 Sat Jun 10 15:51:23 2006 +++ php-src/ext/standard/string.c Sun Jun 11 20:33:29 2006 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: string.c,v 1.544 2006/06/10 15:51:23 iliaa Exp $ */ +/* $Id: string.c,v 1.545 2006/06/11 20:33:29 bjori Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -3520,7 +3520,7 @@ */ PHPAPI UChar *php_u_strtr(UChar *str, int len, UChar *str_from, int str_from_len, UChar *str_to, int str_to_len, int trlen, int *outlen TSRMLS_DC) { - int i, j; + int i; int can_optimize = 1; if ((trlen 1) || (len 1)) { http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.77r2=1.78diff_format=u Index: php-src/ext/standard/streamsfuncs.c diff -u php-src/ext/standard/streamsfuncs.c:1.77 php-src/ext/standard/streamsfuncs.c:1.78 --- php-src/ext/standard/streamsfuncs.c:1.77Wed Apr 19 08:43:05 2006 +++ php-src/ext/standard/streamsfuncs.c Sun Jun 11 20:33:29 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: streamsfuncs.c,v 1.77 2006/04/19 08:43:05 tony2001 Exp $ */ +/* $Id: streamsfuncs.c,v 1.78 2006/06/11 20:33:29 bjori Exp $ */ #include php.h #include php_globals.h @@ -387,7 +387,7 @@ php_stream *stream; zval *zsrc; long maxlen = PHP_STREAM_COPY_ALL, pos = 0; - int len, newlen; + int len; char *contents = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, r|ll, zsrc, maxlen, pos) == FAILURE) { http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/exec.c?r1=1.119r2=1.120diff_format=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.119 php-src/ext/standard/exec.c:1.120 --- php-src/ext/standard/exec.c:1.119 Sat Apr 29 14:53:26 2006 +++ php-src/ext/standard/exec.c Sun Jun 11 20:33:29 2006 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.119 2006/04/29 14:53:26 fmk Exp $ */ +/* $Id: exec.c,v 1.120 2006/06/11 20:33:29 bjori Exp $ */ #include stdio.h #include php.h @@ -59,7 +59,7 @@ int php_exec(int type, char *cmd, zval *array, zval *return_value TSRMLS_DC) { FILE *fp; - char *buf, *tmp=NULL; + char *buf; int l, pclose_return; char *cmd_p, *b, *d=NULL; php_stream *stream; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
iliaa Sun Feb 6 17:58:47 2005 EDT Modified files: /php-src/ext/standard exec.c Log: Fixed possible un-initialized var on error. http://cvs.php.net/diff.php/php-src/ext/standard/exec.c?r1=1.111r2=1.112ty=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.111 php-src/ext/standard/exec.c:1.112 --- php-src/ext/standard/exec.c:1.111 Mon Jul 12 14:49:47 2004 +++ php-src/ext/standard/exec.c Sun Feb 6 17:58:46 2005 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.111 2004/07/12 18:49:47 iliaa Exp $ */ +/* $Id: exec.c,v 1.112 2005/02/06 22:58:46 iliaa Exp $ */ #include stdio.h #include php.h @@ -66,7 +66,7 @@ php_stream *stream; size_t buflen, bufl = 0; #if PHP_SIGCHILD - void (*sig_handler)(); + void (*sig_handler)() = NULL; #endif if (PG(safe_mode)) { @@ -177,7 +177,9 @@ done: #if PHP_SIGCHILD - signal (SIGCHLD, sig_handler); + if (sig_handler) { + signal(SIGCHLD, sig_handler); + } #endif if (d) { efree(d); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
iliaa Mon Jul 12 14:49:47 2004 EDT Modified files: /php-src/ext/standard exec.c Log: Missing patch. http://cvs.php.net/diff.php/php-src/ext/standard/exec.c?r1=1.110r2=1.111ty=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.110 php-src/ext/standard/exec.c:1.111 --- php-src/ext/standard/exec.c:1.110 Tue May 18 09:43:24 2004 +++ php-src/ext/standard/exec.c Mon Jul 12 14:49:47 2004 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.110 2004/05/18 13:43:24 iliaa Exp $ */ +/* $Id: exec.c,v 1.111 2004/07/12 18:49:47 iliaa Exp $ */ #include stdio.h #include php.h @@ -197,11 +197,11 @@ int ret; if (mode) { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z, cmd, cmd_len, ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z/, cmd, cmd_len, ret_code) == FAILURE) { RETURN_FALSE; } } else { - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|zz, cmd, cmd_len, ret_array, ret_code) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, s|z/z/, cmd, cmd_len, ret_array, ret_code) == FAILURE) { RETURN_FALSE; } } @@ -213,8 +213,10 @@ if (!ret_array) { ret = php_exec(mode, cmd, NULL, return_value TSRMLS_CC); } else { - zval_dtor(ret_array); - array_init(ret_array); + if (Z_TYPE_P(ret_array) != IS_ARRAY) { + zval_dtor(ret_array); + array_init(ret_array); + } ret = php_exec(2, cmd, ret_array, return_value TSRMLS_CC); } if (ret_code) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
iliaa Tue May 18 09:43:25 2004 EDT Modified files: /php-src/ext/standard exec.c Log: Fixed command line escaping routines for win32. http://cvs.php.net/diff.php/php-src/ext/standard/exec.c?r1=1.109r2=1.110ty=u Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.109 php-src/ext/standard/exec.c:1.110 --- php-src/ext/standard/exec.c:1.109 Wed Jan 21 11:57:13 2004 +++ php-src/ext/standard/exec.c Tue May 18 09:43:24 2004 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.109 2004/01/21 16:57:13 iliaa Exp $ */ +/* $Id: exec.c,v 1.110 2004/05/18 13:43:24 iliaa Exp $ */ #include stdio.h #include php.h @@ -269,6 +269,7 @@ switch (str[x]) { case '': case '\'': +#ifndef PHP_WIN32 if (!p (p = memchr(str + x + 1, str[x], l - x - 1))) { /* noop */ } else if (p *p == str[x]) { @@ -278,6 +279,7 @@ } cmd[y++] = str[x]; break; +#endif case '#': /* This is character-set independent */ case '': case ';': @@ -299,6 +301,12 @@ case '\\': case '\x0A': /* excluding these two */ case '\xFF': +#ifdef PHP_WIN32 + /* since Windows does not allow us to escape these chars, just remove them */ + case '%': + cmd[y++] = ' '; + break; +#endif cmd[y++] = '\\'; /* fall-through */ default: @@ -332,7 +340,9 @@ switch (str[x]) { #ifdef PHP_WIN32 case '': - cmd[y++] = '\\'; + case '%': + cmd[y++] = ' '; + break; #else case '\'': cmd[y++] = '\''; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
iliaa Wed Nov 19 10:34:31 2003 EDT Modified files: /php-src/ext/standard exec.c Log: Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows). Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.105 php-src/ext/standard/exec.c:1.106 --- php-src/ext/standard/exec.c:1.105 Fri Sep 26 04:09:55 2003 +++ php-src/ext/standard/exec.c Wed Nov 19 10:34:30 2003 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.105 2003/09/26 08:09:55 hholzgra Exp $ */ +/* $Id: exec.c,v 1.106 2003/11/19 15:34:30 iliaa Exp $ */ #include stdio.h #include php.h @@ -322,20 +322,33 @@ cmd = safe_emalloc(4, l, 3); /* worst case */ +#ifdef PHP_WIN32 + cmd[y++] = ''; +#else cmd[y++] = '\''; - +#endif + for (x = 0; x l; x++) { switch (str[x]) { +#ifdef PHP_WIN32 + case '': + cmd[y++] = '\\'; +#else case '\'': cmd[y++] = '\''; cmd[y++] = '\\'; cmd[y++] = '\''; +#endif /* fall-through */ default: cmd[y++] = str[x]; } } +#ifdef PHP_WIN32 + cmd[y++] = ''; +#else cmd[y++] = '\''; +#endif cmd[y] = '\0'; return cmd; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c filters.c fsock.c ftp_fopen_wrapper.c http_fopen_wrapper.c var.c
sas Thu Aug 28 12:28:34 2003 EDT Modified files: /php-src/ext/standard exec.c filters.c fsock.c ftp_fopen_wrapper.c http_fopen_wrapper.c var.c Log: kill warnings Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.103 php-src/ext/standard/exec.c:1.104 --- php-src/ext/standard/exec.c:1.103 Mon Aug 11 19:16:53 2003 +++ php-src/ext/standard/exec.c Thu Aug 28 12:28:33 2003 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.103 2003/08/11 23:16:53 iliaa Exp $ */ +/* $Id: exec.c,v 1.104 2003/08/28 16:28:33 sas Exp $ */ #include stdio.h #include php.h @@ -79,7 +79,7 @@ goto err; } b = strrchr(cmd, PHP_DIR_SEPARATOR); - spprintf(d, 0, %s%s%s%s, PG(safe_mode_exec_dir), (b ? : /), (b ? b : cmd), (c ? : ), (c ? c : )); + spprintf(d, 0, %s%s%s%s%s, PG(safe_mode_exec_dir), (b ? : /), (b ? b : cmd), (c ? : ), (c ? c : )); if (c) { *(c - 1) = ' '; } Index: php-src/ext/standard/filters.c diff -u php-src/ext/standard/filters.c:1.34 php-src/ext/standard/filters.c:1.35 --- php-src/ext/standard/filters.c:1.34 Tue Jun 10 16:03:37 2003 +++ php-src/ext/standard/filters.c Thu Aug 28 12:28:33 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: filters.c,v 1.34 2003/06/10 20:03:37 imajes Exp $ */ +/* $Id: filters.c,v 1.35 2003/08/28 16:28:33 sas Exp $ */ #include php.h #include php_globals.h @@ -1181,6 +1181,7 @@ return PHP_CONV_ERR_SUCCESS; } +#if IT_WAS_USED static php_conv_err_t php_conv_get_long_prop_ex(const HashTable *ht, long *pretval, char *field_name, size_t field_name_len) { zval **tmpval; @@ -1202,6 +1203,7 @@ } return PHP_CONV_ERR_SUCCESS; } +#endif static php_conv_err_t php_conv_get_ulong_prop_ex(const HashTable *ht, unsigned long *pretval, char *field_name, size_t field_name_len) { @@ -1252,6 +1254,7 @@ } +#if IT_WAS_USED static int php_conv_get_int_prop_ex(const HashTable *ht, int *pretval, char *field_name, size_t field_name_len) { long l; @@ -1264,6 +1267,7 @@ } return err; } +#endif static int php_conv_get_uint_prop_ex(const HashTable *ht, unsigned int *pretval, char *field_name, size_t field_name_len) { @@ -1661,7 +1665,7 @@ php_stream_filter *retval = NULL; char *dot; - int conv_mode; + int conv_mode = 0; if (filterparams != NULL Z_TYPE_P(filterparams) != IS_ARRAY) { php_error_docref(NULL TSRMLS_CC, E_WARNING, stream filter (%s): invalid filter parameter, filtername); Index: php-src/ext/standard/fsock.c diff -u php-src/ext/standard/fsock.c:1.114 php-src/ext/standard/fsock.c:1.115 --- php-src/ext/standard/fsock.c:1.114 Thu Aug 28 11:16:20 2003 +++ php-src/ext/standard/fsock.cThu Aug 28 12:28:33 2003 @@ -18,7 +18,7 @@ +--+ */ -/* $Id: fsock.c,v 1.114 2003/08/28 15:16:20 sas Exp $ */ +/* $Id: fsock.c,v 1.115 2003/08/28 16:28:33 sas Exp $ */ #include php.h #include php_globals.h @@ -56,7 +56,7 @@ } if (port 0) { - hostname_len = spprintf(hostname, 0, %s:%d, host, port); + hostname_len = spprintf(hostname, 0, %s:%ld, host, port); } else { hostname_len = host_len; hostname = host; Index: php-src/ext/standard/ftp_fopen_wrapper.c diff -u php-src/ext/standard/ftp_fopen_wrapper.c:1.61 php-src/ext/standard/ftp_fopen_wrapper.c:1.62 --- php-src/ext/standard/ftp_fopen_wrapper.c:1.61 Mon Aug 25 18:25:33 2003 +++ php-src/ext/standard/ftp_fopen_wrapper.cThu Aug 28 12:28:33 2003 @@ -18,7 +18,7 @@ | Sara Golemon [EMAIL PROTECTED] | +--+ */ -/* $Id: ftp_fopen_wrapper.c,v 1.61 2003/08/25 22:25:33 pollita Exp $ */ +/* $Id: ftp_fopen_wrapper.c,v 1.62 2003/08/28 16:28:33 sas Exp $ */ #include php.h #include php_globals.h @@ -477,7 +477,7 @@ php_stream_context_get_option(context, ftp, resume_pos, tmpzval) == SUCCESS Z_TYPE_PP(tmpzval) == IS_LONG Z_LVAL_PP(tmpzval) 0) { - snprintf(tmp_line, 511, REST %u\r\n, Z_LVAL_PP(tmpzval)); + snprintf(tmp_line, 511, REST %ld\r\n, Z_LVAL_PP(tmpzval)); php_stream_write_string(stream, tmp_line); result = GET_FTP_RESULT(stream); if (result 300 || result 399) { Index:
[PHP-CVS] cvs: php-src /ext/standard exec.c
zeevThu Aug 7 11:51:06 2003 EDT Modified files: /php-src/ext/standard exec.c Log: Fix docline Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.101 php-src/ext/standard/exec.c:1.102 --- php-src/ext/standard/exec.c:1.101 Tue Aug 5 16:15:53 2003 +++ php-src/ext/standard/exec.c Thu Aug 7 11:51:05 2003 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.101 2003/08/05 20:15:53 iliaa Exp $ */ +/* $Id: exec.c,v 1.102 2003/08/07 15:51:05 zeev Exp $ */ #include stdio.h #include php.h @@ -382,7 +382,7 @@ /* }}} */ /* {{{ proto string shell_exec(string cmd) - Use pclose() for FILE* that has been opened via popen() */ + Execute command via shell and return complete output as string */ PHP_FUNCTION(shell_exec) { FILE *in; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /ext/standard exec.c
iliaa Tue Aug 5 16:15:53 2003 EDT Modified files: /php-src/ext/standard exec.c Log: Fixed bug #18291 (escapeshellcmd() can now handle quoted arguments). Index: php-src/ext/standard/exec.c diff -u php-src/ext/standard/exec.c:1.100 php-src/ext/standard/exec.c:1.101 --- php-src/ext/standard/exec.c:1.100 Tue Jun 10 16:03:37 2003 +++ php-src/ext/standard/exec.c Tue Aug 5 16:15:53 2003 @@ -16,7 +16,7 @@ | Ilia Alshanetsky [EMAIL PROTECTED] | +--+ */ -/* $Id: exec.c,v 1.100 2003/06/10 20:03:37 imajes Exp $ */ +/* $Id: exec.c,v 1.101 2003/08/05 20:15:53 iliaa Exp $ */ #include stdio.h #include php.h @@ -260,18 +260,28 @@ char *php_escape_shell_cmd(char *str) { register int x, y, l; char *cmd; + char *p = NULL; l = strlen(str); cmd = emalloc(2 * l + 1); for (x = 0, y = 0; x l; x++) { switch (str[x]) { + case '': + case '\'': + if (!p (p = memchr(str + x + 1, str[x], l - x - 1))) { + /* noop */ + } else if (p *p == str[x]) { + p = NULL; + } else { + cmd[y++] = '\\'; + } + cmd[y++] = str[x]; + break; case '#': /* This is character-set independent */ case '': case ';': case '`': - case '\'': - case '': case '|': case '*': case '?': -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php