[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/standard/array.c trunk/ext/standard/array.c

2010-11-01 Thread Felipe Pena
felipe   Mon, 01 Nov 2010 17:16:47 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305011

Log:
- Fixed bug #47643 (array_diff() takes over 3000 times longer than php 5.2.4)

Bug: http://bugs.php.net/47643 (Assigned) array_diff() takes over 3000 times 
longer than php 5.2.4
  
Changed paths:
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/standard/array.c
U   php/php-src/trunk/ext/standard/array.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-11-01 15:09:00 UTC (rev 305010)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-11-01 17:16:47 UTC (rev 305011)
@@ -160,6 +160,8 @@
 - Fixed bug #49215 (make fails on glob_wrapper). (Felipe)
 - Fixed bug #48831 (php -i has different output to php --ini). (Richard,
   Pierre)
+- Fixed bug #47643 (array_diff() takes over 3000 times longer than php 5.2.4).
+  (Felipe)
 - Fixed bug #45921 (Can't initialize character set hebrew). (Andrey)
 - Fixed bug #44248 (RFC2616 transgression while HTTPS request through proxy
   with SoapClient object). (Dmitry)

Modified: php/php-src/branches/PHP_5_3/ext/standard/array.c
===
--- php/php-src/branches/PHP_5_3/ext/standard/array.c   2010-11-01 15:09:00 UTC 
(rev 305010)
+++ php/php-src/branches/PHP_5_3/ext/standard/array.c   2010-11-01 17:16:47 UTC 
(rev 305011)
@@ -3557,8 +3557,8 @@
for (i = 1; i  arr_argc; i++) {
Bucket **ptr = ptrs[i];
if (behavior == DIFF_NORMAL) {
-   while (*ptr  (0  (c = 
diff_data_compare_func(ptrs[0], ptr TSRMLS_CC {
-   ptr++;
+   while (*ptrs[i]  (0  (c = 
diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC {
+   ptrs[i]++;
}
} else if (behavior  DIFF_ASSOC) { /* triggered also 
when DIFF_KEY */
while (*ptr  (0 != (c = 
diff_key_compare_func(ptrs[0], ptr TSRMLS_CC {

Modified: php/php-src/trunk/ext/standard/array.c
===
--- php/php-src/trunk/ext/standard/array.c  2010-11-01 15:09:00 UTC (rev 
305010)
+++ php/php-src/trunk/ext/standard/array.c  2010-11-01 17:16:47 UTC (rev 
305011)
@@ -3561,8 +3561,8 @@
for (i = 1; i  arr_argc; i++) {
Bucket **ptr = ptrs[i];
if (behavior == DIFF_NORMAL) {
-   while (*ptr  (0  (c = 
diff_data_compare_func(ptrs[0], ptr TSRMLS_CC {
-   ptr++;
+   while (*ptrs[i]  (0  (c = 
diff_data_compare_func(ptrs[0], ptrs[i] TSRMLS_CC {
+   ptrs[i]++;
}
} else if (behavior  DIFF_ASSOC) { /* triggered also 
when DIFF_KEY */
while (*ptr  (0 != (c = 
diff_key_compare_func(ptrs[0], ptr TSRMLS_CC {

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

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/date/lib/timezonedb.h trunk/ext/date/lib/timezonedb.h

2010-11-01 Thread Derick Rethans
derick   Mon, 01 Nov 2010 17:55:42 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305012

Log:
- Updated to version 2010.15 (2010o)

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h
U   php/php-src/trunk/ext/date/lib/timezonedb.h

Modified: php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h
===
--- php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h  2010-11-01 
17:16:47 UTC (rev 305011)
+++ php/php-src/branches/PHP_5_3/ext/date/lib/timezonedb.h  2010-11-01 
17:55:42 UTC (rev 305012)
@@ -16639,7 +16639,7 @@
 0x50, 0x48, 0x50, 0x31, 0x01, 0x57, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 
0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0x91, 
0x05, 0xFC, 0x00,
-0xDA, 0x62, 0x04, 0x38, 0x4C, 0x9F, 0x27, 0xB0, 0x4D, 0x98, 0x45, 0x20, 0x01, 
0x02, 0x03, 0x02,
+0xDA, 0x62, 0x04, 0x38, 0x4C, 0x9F, 0x27, 0xB0, 0x4D, 0x98, 0x53, 0x30, 0x01, 
0x02, 0x03, 0x02,
 0xFF, 0xFF, 0x5F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x5E, 0x48, 0x00, 0x04, 0xFF, 
0xFF, 0x65, 0x50,
 0x00, 0x09, 0xFF, 0xFF, 0x73, 0x60, 0x01, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x53, 
0x41, 0x4D, 0x54,
 0x00, 0x57, 0x53, 0x54, 0x00, 0x57, 0x53, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00,
@@ -16854,7 +16854,7 @@
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 
0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0D, 0x9A, 
0x13, 0xB2, 0x3C,
 0x36, 0x3B, 0x17, 0xE0, 0x36, 0xD7, 0xFA, 0x60, 0x38, 0x24, 0x34, 0x60, 0x38, 
0xB7, 0xDC, 0x60,
-0x4B, 0x11, 0x2C, 0xE0, 0x4B, 0xAE, 0x0F, 0x60, 0x4C, 0xC2, 0xEA, 0x60, 0x4D, 
0x8D, 0xF1, 0x60,
+0x4B, 0x11, 0x2C, 0xE0, 0x4B, 0xAE, 0x0F, 0x60, 0x4C, 0xC2, 0xEA, 0x60, 0x4D, 
0x72, 0x41, 0xE0,
 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0xA7, 0x44, 
0x00, 0x00, 0x00,
 0x00, 0xB6, 0xD0, 0x01, 0x04, 0x00, 0x00, 0xA8, 0xC0, 0x00, 0x09, 0x4C, 0x4D, 
0x54, 0x00, 0x46,
 0x4A, 0x53, 0x54, 0x00, 0x46, 0x4A, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x6D,
@@ -18269,4 +18269,4 @@
 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 
0x12, 0xA8, 0x80,
 0x00, 0x00, 0x00, 0x00, };

-const timelib_tzdb timezonedb_builtin = { 2010.13, 568, 
timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
+const timelib_tzdb timezonedb_builtin = { 2010.15, 568, 
timezonedb_idx_builtin, timelib_timezone_db_data_builtin };

Modified: php/php-src/trunk/ext/date/lib/timezonedb.h
===
--- php/php-src/trunk/ext/date/lib/timezonedb.h 2010-11-01 17:16:47 UTC (rev 
305011)
+++ php/php-src/trunk/ext/date/lib/timezonedb.h 2010-11-01 17:55:42 UTC (rev 
305012)
@@ -16639,7 +16639,7 @@
 0x50, 0x48, 0x50, 0x31, 0x01, 0x57, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 
0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x12, 0x91, 
0x05, 0xFC, 0x00,
-0xDA, 0x62, 0x04, 0x38, 0x4C, 0x9F, 0x27, 0xB0, 0x4D, 0x98, 0x45, 0x20, 0x01, 
0x02, 0x03, 0x02,
+0xDA, 0x62, 0x04, 0x38, 0x4C, 0x9F, 0x27, 0xB0, 0x4D, 0x98, 0x53, 0x30, 0x01, 
0x02, 0x03, 0x02,
 0xFF, 0xFF, 0x5F, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x5E, 0x48, 0x00, 0x04, 0xFF, 
0xFF, 0x65, 0x50,
 0x00, 0x09, 0xFF, 0xFF, 0x73, 0x60, 0x01, 0x0D, 0x4C, 0x4D, 0x54, 0x00, 0x53, 
0x41, 0x4D, 0x54,
 0x00, 0x57, 0x53, 0x54, 0x00, 0x57, 0x53, 0x44, 0x54, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00,
@@ -16854,7 +16854,7 @@
 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 
0x00, 0x00, 0x00,
 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0D, 0x9A, 
0x13, 0xB2, 0x3C,
 0x36, 0x3B, 0x17, 0xE0, 0x36, 0xD7, 0xFA, 0x60, 0x38, 0x24, 0x34, 0x60, 0x38, 
0xB7, 0xDC, 0x60,
-0x4B, 0x11, 0x2C, 0xE0, 0x4B, 0xAE, 0x0F, 0x60, 0x4C, 0xC2, 0xEA, 0x60, 0x4D, 
0x8D, 0xF1, 0x60,
+0x4B, 0x11, 0x2C, 0xE0, 0x4B, 0xAE, 0x0F, 0x60, 0x4C, 0xC2, 0xEA, 0x60, 0x4D, 
0x72, 0x41, 0xE0,
 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0xA7, 0x44, 
0x00, 0x00, 0x00,
 0x00, 0xB6, 0xD0, 0x01, 0x04, 0x00, 0x00, 0xA8, 0xC0, 0x00, 0x09, 0x4C, 0x4D, 
0x54, 0x00, 0x46,
 0x4A, 0x53, 0x54, 0x00, 0x46, 0x4A, 0x54, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x6D,
@@ -18269,4 +18269,4 @@
 0x00, 0x00, 0x55, 0x54, 0x43, 0x00, 0x00, 0x00, 0x00, 0x89, 0x54, 0x40, 0x01, 
0x12, 0xA8, 0x80,
 0x00, 0x00, 0x00, 0x00, };

-const timelib_tzdb timezonedb_builtin = { 2010.13, 568, 
timezonedb_idx_builtin, timelib_timezone_db_data_builtin };
+const timelib_tzdb timezonedb_builtin = { 2010.15, 568, 
timezonedb_idx_builtin, timelib_timezone_db_data_builtin };

-- 
PHP CVS Mailing List 

[PHP-CVS] svn: /php/php-src/trunk/ext/pcntl/ pcntl.c php_pcntl.h tests/pcntl_get_last_error.phpt

2010-11-01 Thread Arnaud Le Blanc
lbarnaud Mon, 01 Nov 2010 20:10:17 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305015

Log:
Fix bug #52173 (ext/pcntl doesn't store/report errors) (patch
by nick dot telford at gmail dot com)

Bug: http://bugs.php.net/52173 (Open) ext/pcntl doesn't store/report errors
  
Changed paths:
U   php/php-src/trunk/ext/pcntl/pcntl.c
U   php/php-src/trunk/ext/pcntl/php_pcntl.h
A   php/php-src/trunk/ext/pcntl/tests/pcntl_get_last_error.phpt

Modified: php/php-src/trunk/ext/pcntl/pcntl.c
===
--- php/php-src/trunk/ext/pcntl/pcntl.c	2010-11-01 17:55:53 UTC (rev 305014)
+++ php/php-src/trunk/ext/pcntl/pcntl.c	2010-11-01 20:10:17 UTC (rev 305015)
@@ -44,6 +44,8 @@
 #include sys/resource.h
 #endif

+#include errno.h
+
 ZEND_DECLARE_MODULE_GLOBALS(pcntl)
 static PHP_GINIT_FUNCTION(pcntl);

@@ -134,6 +136,10 @@
 	ZEND_ARG_INFO(0, process_identifier)
 ZEND_END_ARG_INFO()
 #endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_strerror, 0, 0, 1)
+ZEND_ARG_INFO(0, errno)
+ZEND_END_ARG_INFO()
 /* }}} */

 const zend_function_entry pcntl_functions[] = {
@@ -150,6 +156,9 @@
 	PHP_FE(pcntl_wstopsig,		arginfo_pcntl_wstopsig)
 	PHP_FE(pcntl_exec,			arginfo_pcntl_exec)
 	PHP_FE(pcntl_alarm,			arginfo_pcntl_alarm)
+	PHP_FE(pcntl_get_last_error,	arginfo_pcntl_void)
+	PHP_FALIAS(pcntl_errno, pcntl_get_last_error,	NULL)
+	PHP_FE(pcntl_strerror,		arginfo_pcntl_strerror)
 #ifdef HAVE_GETPRIORITY
 	PHP_FE(pcntl_getpriority,	arginfo_pcntl_getpriority)
 #endif
@@ -407,6 +416,73 @@
 	/* }}} */
 }

+static void php_pcntl_register_errno_constants(INIT_FUNC_ARGS)
+{
+#ifdef EINTR
+	REGISTER_PCNTL_ERRNO_CONSTANT(EINTR);
+#endif
+#ifdef ECHILD
+	REGISTER_PCNTL_ERRNO_CONSTANT(ECHILD);
+#endif
+#ifdef EINVAL
+	REGISTER_PCNTL_ERRNO_CONSTANT(EINVAL);
+#endif
+#ifdef EAGAIN
+	REGISTER_PCNTL_ERRNO_CONSTANT(EAGAIN);
+#endif
+#ifdef ESRCH
+	REGISTER_PCNTL_ERRNO_CONSTANT(ESRCH);
+#endif
+#ifdef EACCES
+	REGISTER_PCNTL_ERRNO_CONSTANT(EACCES);
+#endif
+#ifdef EPERM
+	REGISTER_PCNTL_ERRNO_CONSTANT(EPERM);
+#endif
+#ifdef ENOMEM
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOMEM);
+#endif
+#ifdef E2BIG
+	REGISTER_PCNTL_ERRNO_CONSTANT(E2BIG);
+#endif
+#ifdef EFAULT
+	REGISTER_PCNTL_ERRNO_CONSTANT(EFAULT);
+#endif
+#ifdef EIO
+	REGISTER_PCNTL_ERRNO_CONSTANT(EIO);
+#endif
+#ifdef EISDIR
+	REGISTER_PCNTL_ERRNO_CONSTANT(EISDIR);
+#endif
+#ifdef ELIBBAD
+	REGISTER_PCNTL_ERRNO_CONSTANT(ELIBBAD);
+#endif
+#ifdef ELOOP
+	REGISTER_PCNTL_ERRNO_CONSTANT(ELOOP);
+#endif
+#ifdef EMFILE
+	REGISTER_PCNTL_ERRNO_CONSTANT(EMFILE);
+#endif
+#ifdef ENAMETOOLONG
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENAMETOOLONG);
+#endif
+#ifdef ENFILE
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENFILE);
+#endif
+#ifdef ENOENT
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOENT);
+#endif
+#ifdef ENOEXEC
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOEXEC);
+#endif
+#ifdef ENOTDIR
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOTDIR);
+#endif
+#ifdef ETXTBSY
+	REGISTER_PCNTL_ERRNO_CONSTANT(ETXTBSY);
+#endif
+}
+
 static PHP_GINIT_FUNCTION(pcntl)
 {
 	memset(pcntl_globals, 0, sizeof(*pcntl_globals));
@@ -422,6 +498,7 @@
 PHP_MINIT_FUNCTION(pcntl)
 {
 	php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
+	php_pcntl_register_errno_constants(INIT_FUNC_ARGS_PASSTHRU);
 	php_add_tick_function(pcntl_signal_dispatch);

 	return SUCCESS;
@@ -467,6 +544,7 @@

 	id = fork();
 	if (id == -1) {
+		PCNTL_G(last_error) = errno;
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, Error %d, errno);
 	}

@@ -505,6 +583,10 @@

 	child_id = waitpid((pid_t) pid, status, options);

+	if (child_id  0) {
+		PCNTL_G(last_error) = errno;
+	}
+
 	Z_LVAL_P(z_status) = status;

 	RETURN_LONG((long) child_id);
@@ -536,6 +618,10 @@
 #else
 	child_id = wait(status);
 #endif
+	if (child_id  0) {
+		PCNTL_G(last_error) = errno;
+	}
+
 	Z_LVAL_P(z_status) = status;

 	RETURN_LONG((long) child_id);
@@ -729,6 +815,7 @@
 		*(pair) = NULL;

 		if (execve(path, argv, envp) == -1) {
+			PCNTL_G(last_error) = errno;
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, Error has occured: (errno %d) %s, errno, strerror(errno));
 		}

@@ -738,6 +825,7 @@
 	} else {

 		if (execv(path, argv) == -1) {
+			PCNTL_G(last_error) = errno;
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, Error has occured: (errno %d) %s, errno, strerror(errno));
 		}
 	}
@@ -780,6 +868,7 @@
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid value for handle argument specified);
 		}
 		if (php_signal(signo, (Sigfunc *) Z_LVAL_P(handle), (int) restart_syscalls) == SIG_ERR) {
+			PCNTL_G(last_error) = errno;
 			php_error_docref(NULL TSRMLS_CC, E_WARNING, Error assigning signal);
 			RETURN_FALSE;
 		}
@@ -787,6 +876,7 @@
 	}

 	if (!zend_is_callable(handle, 0, func_name TSRMLS_CC)) {
+		PCNTL_G(last_error) = EINVAL;
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, %s is not a callable function name error, func_name);
 		efree(func_name);
 		RETURN_FALSE;
@@ -798,6 +888,7 @@
 	if (dest_handle) 

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS ext/pcntl/pcntl.c ext/pcntl/php_pcntl.h ext/pcntl/tests/pcntl_get_last_error.phpt sapi/fpm/php-fpm.8.in tests/security/open_basedir_parse_ini_file.ph

2010-11-01 Thread Arnaud Le Blanc
lbarnaud Mon, 01 Nov 2010 20:22:23 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305016

Log:
MFH Fix bug #52173 (ext/pcntl doesn't store/report errors)
(patch by nick dot telford at gmail dot com)

Bug: http://bugs.php.net/52173 (Open) ext/pcntl doesn't store/report errors
  
Changed paths:
_U  php/php-src/branches/PHP_5_3/
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c
U   php/php-src/branches/PHP_5_3/ext/pcntl/php_pcntl.h
A + php/php-src/branches/PHP_5_3/ext/pcntl/tests/pcntl_get_last_error.phpt
(from 
php/php-src/trunk/ext/pcntl/tests/pcntl_get_last_error.phpt:r305015)
_U  php/php-src/branches/PHP_5_3/ext/spl/tests/
_U  php/php-src/branches/PHP_5_3/ext/tidy/tests/
_U  php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.8.in
_U  
php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt


Property changes on: php/php-src/branches/PHP_5_3
___
Modified: svn:mergeinfo
   - /php/php-src/trunk:284726
   + /php/php-src/trunk:284726,305015

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS	2010-11-01 20:10:17 UTC (rev 305015)
+++ php/php-src/branches/PHP_5_3/NEWS	2010-11-01 20:22:23 UTC (rev 305016)
@@ -10,6 +10,8 @@
   (Andrey)
 - Improved support for is_link and related functions on Windows. (Pierre)

+- Implemented FR #52173, added functions pcntl_get_last_error() and
+  pcntl_strerror(). (nick dot telford at gmail dot com, Arnaud)
 - Implemented symbolic links support for open_basedir checks. (Pierre)
 - Implemented FR #51804, SplFileInfo::getLinkTarget on Windows. (Pierre)
 - Implemented FR #50692, not uploaded files don't count towards

Modified: php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c
===
--- php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c	2010-11-01 20:10:17 UTC (rev 305015)
+++ php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c	2010-11-01 20:22:23 UTC (rev 305016)
@@ -44,6 +44,8 @@
 #include sys/resource.h
 #endif

+#include errno.h
+
 ZEND_DECLARE_MODULE_GLOBALS(pcntl)
 static PHP_GINIT_FUNCTION(pcntl);

@@ -134,6 +136,10 @@
 	ZEND_ARG_INFO(0, process_identifier)
 ZEND_END_ARG_INFO()
 #endif
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_pcntl_strerror, 0, 0, 1)
+ZEND_ARG_INFO(0, errno)
+ZEND_END_ARG_INFO()
 /* }}} */

 const zend_function_entry pcntl_functions[] = {
@@ -150,6 +156,9 @@
 	PHP_FE(pcntl_wstopsig,		arginfo_pcntl_wstopsig)
 	PHP_FE(pcntl_exec,			arginfo_pcntl_exec)
 	PHP_FE(pcntl_alarm,			arginfo_pcntl_alarm)
+	PHP_FE(pcntl_get_last_error,	arginfo_pcntl_void)
+	PHP_FALIAS(pcntl_errno, pcntl_get_last_error,	NULL)
+	PHP_FE(pcntl_strerror,		arginfo_pcntl_strerror)
 #ifdef HAVE_GETPRIORITY
 	PHP_FE(pcntl_getpriority,	arginfo_pcntl_getpriority)
 #endif
@@ -407,6 +416,73 @@
 	/* }}} */
 }

+static void php_pcntl_register_errno_constants(INIT_FUNC_ARGS)
+{
+#ifdef EINTR
+	REGISTER_PCNTL_ERRNO_CONSTANT(EINTR);
+#endif
+#ifdef ECHILD
+	REGISTER_PCNTL_ERRNO_CONSTANT(ECHILD);
+#endif
+#ifdef EINVAL
+	REGISTER_PCNTL_ERRNO_CONSTANT(EINVAL);
+#endif
+#ifdef EAGAIN
+	REGISTER_PCNTL_ERRNO_CONSTANT(EAGAIN);
+#endif
+#ifdef ESRCH
+	REGISTER_PCNTL_ERRNO_CONSTANT(ESRCH);
+#endif
+#ifdef EACCES
+	REGISTER_PCNTL_ERRNO_CONSTANT(EACCES);
+#endif
+#ifdef EPERM
+	REGISTER_PCNTL_ERRNO_CONSTANT(EPERM);
+#endif
+#ifdef ENOMEM
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOMEM);
+#endif
+#ifdef E2BIG
+	REGISTER_PCNTL_ERRNO_CONSTANT(E2BIG);
+#endif
+#ifdef EFAULT
+	REGISTER_PCNTL_ERRNO_CONSTANT(EFAULT);
+#endif
+#ifdef EIO
+	REGISTER_PCNTL_ERRNO_CONSTANT(EIO);
+#endif
+#ifdef EISDIR
+	REGISTER_PCNTL_ERRNO_CONSTANT(EISDIR);
+#endif
+#ifdef ELIBBAD
+	REGISTER_PCNTL_ERRNO_CONSTANT(ELIBBAD);
+#endif
+#ifdef ELOOP
+	REGISTER_PCNTL_ERRNO_CONSTANT(ELOOP);
+#endif
+#ifdef EMFILE
+	REGISTER_PCNTL_ERRNO_CONSTANT(EMFILE);
+#endif
+#ifdef ENAMETOOLONG
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENAMETOOLONG);
+#endif
+#ifdef ENFILE
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENFILE);
+#endif
+#ifdef ENOENT
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOENT);
+#endif
+#ifdef ENOEXEC
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOEXEC);
+#endif
+#ifdef ENOTDIR
+	REGISTER_PCNTL_ERRNO_CONSTANT(ENOTDIR);
+#endif
+#ifdef ETXTBSY
+	REGISTER_PCNTL_ERRNO_CONSTANT(ETXTBSY);
+#endif
+}
+
 static PHP_GINIT_FUNCTION(pcntl)
 {
 	memset(pcntl_globals, 0, sizeof(*pcntl_globals));
@@ -422,6 +498,7 @@
 PHP_MINIT_FUNCTION(pcntl)
 {
 	php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
+	php_pcntl_register_errno_constants(INIT_FUNC_ARGS_PASSTHRU);
 	php_add_tick_function(pcntl_signal_dispatch);

 	return SUCCESS;
@@ -467,6 +544,7 @@

 	id = fork();
 	if (id == -1) {
+		PCNTL_G(last_error) = errno;
 		php_error_docref(NULL TSRMLS_CC, E_WARNING, Error %d, errno);
 	}

@@ -505,6 +583,10 @@

 	child_id = waitpid((pid_t) pid, status, 

[PHP-CVS] svn: /php/php-src/trunk/ext/pcntl/ pcntl.c php_signal.c php_signal.h

2010-11-01 Thread Arnaud Le Blanc
lbarnaud Mon, 01 Nov 2010 22:29:25 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305018

Log:
fixed bug #52784 (Race condition when handling many
concurrent signals)

Bug: http://bugs.php.net/52784 (Assigned) Race condition when handling many 
concurrent signals
  
Changed paths:
U   php/php-src/trunk/ext/pcntl/pcntl.c
U   php/php-src/trunk/ext/pcntl/php_signal.c
U   php/php-src/trunk/ext/pcntl/php_signal.h

Modified: php/php-src/trunk/ext/pcntl/pcntl.c
===
--- php/php-src/trunk/ext/pcntl/pcntl.c 2010-11-01 20:31:39 UTC (rev 305017)
+++ php/php-src/trunk/ext/pcntl/pcntl.c 2010-11-01 22:29:25 UTC (rev 305018)
@@ -887,7 +887,7 @@
zend_hash_index_update(PCNTL_G(php_signal_table), signo, (void **) 
handle, sizeof(zval *), (void **) dest_handle);
if (dest_handle) zval_add_ref(dest_handle);

-   if (php_signal(signo, pcntl_signal_handler, (int) restart_syscalls) == 
SIG_ERR) {
+   if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) 
== SIG_ERR) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL TSRMLS_CC, E_WARNING, Error assigning 
signal);
RETURN_FALSE;
@@ -1224,7 +1224,13 @@
 {
zval *param, **handle, *retval;
struct php_pcntl_pending_signal *queue, *next;
+   sigset_t mask;
+   sigset_t old_mask;
TSRMLS_FETCH();
+
+   /* Mask all signals */
+   sigfillset(mask);
+   sigprocmask(SIG_BLOCK, mask, old_mask);

/* Bail if the queue is empty or if we are already playing the queue*/
if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue))
@@ -1260,6 +1266,9 @@

/* Re-enable queue */
PCNTL_G(processing_signal_queue) = 0;
+
+   /* return signal mask to previous state */
+   sigprocmask(SIG_SETMASK, old_mask, NULL);
 }



Modified: php/php-src/trunk/ext/pcntl/php_signal.c
===
--- php/php-src/trunk/ext/pcntl/php_signal.c2010-11-01 20:31:39 UTC (rev 
305017)
+++ php/php-src/trunk/ext/pcntl/php_signal.c2010-11-01 22:29:25 UTC (rev 
305018)
@@ -22,11 +22,15 @@

 /* php_signal using sigaction is derrived from Advanced Programing
  * in the Unix Environment by W. Richard Stevens p 298. */
-Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
+Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
 {
struct sigaction act,oact;
act.sa_handler = func;
-   sigemptyset(act.sa_mask);
+   if (mask_all) {
+   sigfillset(act.sa_mask);
+   } else {
+   sigemptyset(act.sa_mask);
+   }
act.sa_flags = 0;
if (signo == SIGALRM || (! restart)) {
 #ifdef SA_INTERRUPT
@@ -43,6 +47,11 @@
return oact.sa_handler;
 }

+Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
+{
+   return php_signal4(signo, func, restart, 0);
+}
+
 /*
  * Local variables:
  * tab-width: 4

Modified: php/php-src/trunk/ext/pcntl/php_signal.h
===
--- php/php-src/trunk/ext/pcntl/php_signal.h2010-11-01 20:31:39 UTC (rev 
305017)
+++ php/php-src/trunk/ext/pcntl/php_signal.h2010-11-01 22:29:25 UTC (rev 
305018)
@@ -31,5 +31,6 @@

 typedef void Sigfunc(int);
 Sigfunc *php_signal(int signo, Sigfunc *func, int restart);
+Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all);

 #endif

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

[PHP-CVS] svn: /php/php-src/trunk/ext/pcntl/ pcntl.c

2010-11-01 Thread Arnaud Le Blanc
lbarnaud Mon, 01 Nov 2010 22:40:29 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305019

Log:
fix the fix

Changed paths:
U   php/php-src/trunk/ext/pcntl/pcntl.c

Modified: php/php-src/trunk/ext/pcntl/pcntl.c
===
--- php/php-src/trunk/ext/pcntl/pcntl.c 2010-11-01 22:29:25 UTC (rev 305018)
+++ php/php-src/trunk/ext/pcntl/pcntl.c 2010-11-01 22:40:29 UTC (rev 305019)
@@ -1233,8 +1233,10 @@
sigprocmask(SIG_BLOCK, mask, old_mask);

/* Bail if the queue is empty or if we are already playing the queue*/
-   if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue))
+   if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue)) {
+   sigprocmask(SIG_SETMASK, old_mask, NULL);
return;
+   }

/* Prevent reentrant handler calls */
PCNTL_G(processing_signal_queue) = 1;

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

[PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ NEWS ext/pcntl/pcntl.c ext/pcntl/php_signal.c ext/pcntl/php_signal.h sapi/fpm/php-fpm.8.in tests/security/open_basedir_parse_ini_file.phpt

2010-11-01 Thread Arnaud Le Blanc
lbarnaud Mon, 01 Nov 2010 22:43:59 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305020

Log:
MFH fixed bug #52784 (Race condition when handling many
concurrent signals)

Bug: http://bugs.php.net/52784 (Assigned) Race condition when handling many 
concurrent signals
  
Changed paths:
_U  php/php-src/branches/PHP_5_3/
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c
U   php/php-src/branches/PHP_5_3/ext/pcntl/php_signal.c
U   php/php-src/branches/PHP_5_3/ext/pcntl/php_signal.h
_U  php/php-src/branches/PHP_5_3/ext/spl/tests/
_U  php/php-src/branches/PHP_5_3/ext/tidy/tests/
_U  php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.8.in
_U  
php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt


Property changes on: php/php-src/branches/PHP_5_3
___
Modified: svn:mergeinfo
   - /php/php-src/trunk:284726,305015
   + /php/php-src/trunk:284726,305015,305018-305019

Modified: php/php-src/branches/PHP_5_3/NEWS
===
--- php/php-src/branches/PHP_5_3/NEWS   2010-11-01 22:40:29 UTC (rev 305019)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-11-01 22:43:59 UTC (rev 305020)
@@ -88,6 +88,8 @@
   (CURLOPT_STDERR)). (Gustavo)
 - Fixed bug #52786 (PHP should reset section to [PHP] after ini sections).
   (Fedora at famillecollet dot com)
+- Fixed bug #52784 (Race condition when handling many concurrent signals).
+  (nick dot telford at gmail dot com, Arnaud)
 - Fixed bug #52772 (var_dump() doesn't check for the existence of
   get_class_name before calling it). (Kalle, Gustavo)
 - Fixed bug #52744 (cal_days_in_month incorrect for December 1 BCE).

Modified: php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c
===
--- php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c  2010-11-01 22:40:29 UTC 
(rev 305019)
+++ php/php-src/branches/PHP_5_3/ext/pcntl/pcntl.c  2010-11-01 22:43:59 UTC 
(rev 305020)
@@ -887,7 +887,7 @@
zend_hash_index_update(PCNTL_G(php_signal_table), signo, (void **) 
handle, sizeof(zval *), (void **) dest_handle);
if (dest_handle) zval_add_ref(dest_handle);

-   if (php_signal(signo, pcntl_signal_handler, (int) restart_syscalls) == 
SIG_ERR) {
+   if (php_signal4(signo, pcntl_signal_handler, (int) restart_syscalls, 1) 
== SIG_ERR) {
PCNTL_G(last_error) = errno;
php_error_docref(NULL TSRMLS_CC, E_WARNING, Error assigning 
signal);
RETURN_FALSE;
@@ -1224,11 +1224,19 @@
 {
zval *param, **handle, *retval;
struct php_pcntl_pending_signal *queue, *next;
+   sigset_t mask;
+   sigset_t old_mask;
TSRMLS_FETCH();
+
+   /* Mask all signals */
+   sigfillset(mask);
+   sigprocmask(SIG_BLOCK, mask, old_mask);

/* Bail if the queue is empty or if we are already playing the queue*/
-   if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue))
+   if (! PCNTL_G(head) || PCNTL_G(processing_signal_queue)) {
+   sigprocmask(SIG_SETMASK, old_mask, NULL);
return;
+   }

/* Prevent reentrant handler calls */
PCNTL_G(processing_signal_queue) = 1;
@@ -1260,6 +1268,9 @@

/* Re-enable queue */
PCNTL_G(processing_signal_queue) = 0;
+
+   /* return signal mask to previous state */
+   sigprocmask(SIG_SETMASK, old_mask, NULL);
 }



Modified: php/php-src/branches/PHP_5_3/ext/pcntl/php_signal.c
===
--- php/php-src/branches/PHP_5_3/ext/pcntl/php_signal.c 2010-11-01 22:40:29 UTC 
(rev 305019)
+++ php/php-src/branches/PHP_5_3/ext/pcntl/php_signal.c 2010-11-01 22:43:59 UTC 
(rev 305020)
@@ -22,11 +22,15 @@

 /* php_signal using sigaction is derrived from Advanced Programing
  * in the Unix Environment by W. Richard Stevens p 298. */
-Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
+Sigfunc *php_signal4(int signo, Sigfunc *func, int restart, int mask_all)
 {
struct sigaction act,oact;
act.sa_handler = func;
-   sigemptyset(act.sa_mask);
+   if (mask_all) {
+   sigfillset(act.sa_mask);
+   } else {
+   sigemptyset(act.sa_mask);
+   }
act.sa_flags = 0;
if (signo == SIGALRM || (! restart)) {
 #ifdef SA_INTERRUPT
@@ -43,6 +47,11 @@
return oact.sa_handler;
 }

+Sigfunc *php_signal(int signo, Sigfunc *func, int restart)
+{
+   return php_signal4(signo, func, restart, 0);
+}
+
 /*
  * Local variables:
  * tab-width: 4

Modified: php/php-src/branches/PHP_5_3/ext/pcntl/php_signal.h
===
--- php/php-src/branches/PHP_5_3/ext/pcntl/php_signal.h 2010-11-01 22:40:29 UTC 
(rev 305019)
+++ 

[PHP-CVS] svn: /php/php-src/trunk/main/ output.c

2010-11-01 Thread Gustavo André dos Santos Lopes
cataphract   Tue, 02 Nov 2010 03:49:49 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=305022

Log:
- Fixed bug #53153 (memory leak with phpinfo() + output buffering + zlib 
compression).

Bug: http://bugs.php.net/53153 (Assigned) Memory leak with phpinfo() + output 
buffering + zlib compression
  
Changed paths:
U   php/php-src/trunk/main/output.c

Modified: php/php-src/trunk/main/output.c
===
--- php/php-src/trunk/main/output.c 2010-11-02 03:09:07 UTC (rev 305021)
+++ php/php-src/trunk/main/output.c 2010-11-02 03:49:49 UTC (rev 305022)
@@ -902,7 +902,9 @@
}

} else {
-
+   if (context-in.data  context-in.free) {
+   efree(context-in.data);
+   }
context-in.data = handler-buffer.data;
context-in.used = handler-buffer.used;
context-in.free = 0;

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