cvs: TSRM(PHP_5_2) / tsrm_win32.c php-src NEWS
| From: | Scott MacVicar | Date: | Thu, 29 May 2008 11:41:51 +0000 |
| Subject: | cvs: TSRM(PHP_5_2) / tsrm_win32.c php-src NEWS | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-6753@lists.php.net to get a copy of this message | ||
scottmac Thu May 29 11:41:51 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src NEWS
/TSRM tsrm_win32.c
Log:
MFH: Fix a bug when command is quoted and parameters are quoted during call to exec, the result is
that cmd.exe /c strips the first and last quote.
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1160&r2=1.2027.2.547.2.1161&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1160 php-src/NEWS:1.2027.2.547.2.1161
--- php-src/NEWS:1.2027.2.547.2.1160 Fri May 23 15:46:54 2008
+++ php-src/NEWS Thu May 29 11:41:50 2008
@@ -6,6 +6,8 @@
- Fixed a crash inside PDO when trying instantiate PDORow manually (Felipe)
- Fixed build failure of ext/mysqli with libmysql 6.0 - missing rpl
functions. (Andrey)
+- Fixed a bug where exec() on Windows would eat the first and last double quotes
+ (Scott)
- Fixed bug #45004 (pg_insert() does not accept 4 digit timezone format).
(Ilia)
- Fixed bug #44891 Memory leak using registerPHPFunctions and XSLT Variable
http://cvs.php.net/viewvc.cgi/TSRM/tsrm_win32.c?r1=1.27.2.1.2.8&r2=1.27.2.1.2.9&diff_format=u
Index: TSRM/tsrm_win32.c
diff -u TSRM/tsrm_win32.c:1.27.2.1.2.8 TSRM/tsrm_win32.c:1.27.2.1.2.9
--- TSRM/tsrm_win32.c:1.27.2.1.2.8 Mon Dec 31 07:20:02 2007
+++ TSRM/tsrm_win32.c Thu May 29 11:41:50 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: tsrm_win32.c,v 1.27.2.1.2.8 2007/12/31 07:20:02 sebastian Exp $ */
+/* $Id: tsrm_win32.c,v 1.27.2.1.2.9 2008/05/29 11:41:50 scottmac Exp $ */
#include <stdio.h>
#include <fcntl.h>
@@ -88,7 +88,7 @@
{
if (mode == 1 /*X_OK*/) {
#if 1
- /* This code is not supported by Windows 98,
+ /* This code is not supported by Windows 98,
* but we don't support it anymore */
DWORD type;
@@ -96,7 +96,7 @@
#else
SHFILEINFO sfi;
- return access(pathname, 0) == 0 &&
+ return access(pathname, 0) == 0 &&
SHGetFileInfo(pathname, 0, &sfi, sizeof(SHFILEINFO), SHGFI_EXETYPE) != 0 ? 0 : -1;
#endif
} else {
@@ -109,22 +109,22 @@
{
process_pair *ptr;
process_pair *newptr;
-
+
for (ptr = TWG(process); ptr < (TWG(process) + TWG(process_size)); ptr++) {
if (ptr->stream == stream) {
break;
}
}
-
+
if (ptr < (TWG(process) + TWG(process_size))) {
return ptr;
}
-
+
newptr = (process_pair*)realloc((void*)TWG(process), (TWG(process_size)+1)*sizeof(process_pair));
if (newptr == NULL) {
return NULL;
}
-
+
TWG(process) = newptr;
ptr = newptr + TWG(process_size);
TWG(process_size)++;
@@ -136,7 +136,7 @@
shm_pair *ptr;
shm_pair *newptr;
TSRMLS_FETCH();
-
+
for (ptr = TWG(shm); ptr < (TWG(shm) + TWG(shm_size)); ptr++) {
if (!ptr->descriptor) {
continue;
@@ -151,12 +151,12 @@
if (ptr < (TWG(shm) + TWG(shm_size))) {
return ptr;
}
-
+
newptr = (shm_pair*)realloc((void*)TWG(shm), (TWG(shm_size)+1)*sizeof(shm_pair));
if (newptr == NULL) {
return NULL;
}
-
+
TWG(shm) = newptr;
ptr = newptr + TWG(shm_size);
TWG(shm_size)++;
@@ -195,7 +195,7 @@
if (!str_len || !CreatePipe(&in, &out, &security, 2048L)) {
return NULL;
}
-
+
memset(&startup, 0, sizeof(STARTUPINFO));
memset(&process, 0, sizeof(PROCESS_INFORMATION));
@@ -217,8 +217,8 @@
startup.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
}
- cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c "));
- sprintf(cmd, "%s /c %s", TWG(comspec), command);
+ cmd = (char*)malloc(strlen(command)+strlen(TWG(comspec))+sizeof(" /c ")+2);
+ sprintf(cmd, "%s /c \"%s\"", TWG(comspec), command);
if (!CreateProcess(NULL, cmd, &security, &security, security.bInheritHandle,
NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW, env, cwd, &startup, &process)) {
return NULL;
}