[Pkg-php-commits] [php/debian-sid] Imported Debian patch 5.3.3-1

Raphael Geissert geissert at debian.org
Thu Oct 21 09:46:23 UTC 2010


---
 .gitignore                                         |    1 -
 debian/changelog                                   |   14 +
 debian/control                                     |   24 +-
 debian/patches/036-fd_setsize_fix.patch            |   17 +-
 debian/patches/CVE-2010-0397.patch                 |   58 ---
 debian/patches/bad_whatis_entries.patch            |   34 --
 .../patches/enchant_unaligned_memory_access.patch  |   76 ----
 debian/patches/filter_validate_int.patch           |  124 -------
 .../fix_broken_gd_bundled-specific_tests.patch     |   92 -----
 debian/patches/fix_broken_locale_tests.patch       |   29 --
 debian/patches/fix_var_dump_64bit.phpt.patch       |   25 --
 debian/patches/fpm-config.patch                    |   68 ++++
 debian/patches/fpm_gcc_atomics.patch               |   31 ++
 debian/patches/libdb_is_-ldb                       |   12 +-
 .../patches/php-fpm-man-section-and-cleanup.patch  |   46 +++
 debian/patches/series                              |   36 +--
 debian/patches/suhosin.patch                       |  383 ++++++++++++--------
 .../upstream/SplFileInfo_getPathName_parent.patch  |   40 --
 debian/patches/upstream/date_mem_leak.patch        |   46 ---
 debian/patches/upstream/db4.8_workarounds.patch    |   58 ---
 .../upstream/dba_unaligned_mem_access.patch        |   17 -
 .../patches/upstream/define_json_error_utf8.patch  |   16 -
 debian/patches/upstream/gc_memory_leak.patch       |   16 -
 .../incorrect_SplFileInfo_fscanf_prototype.patch   |   39 --
 .../patches/upstream/incorrect_docroot_eval.patch  |   20 -
 .../patches/upstream/mssql_per_query_timeout.patch |   16 -
 debian/patches/upstream/multiple_typos.patch       |   78 ----
 .../upstream/mysqli_options_mem_issue.patch        |   54 ---
 debian/patches/upstream/mysqli_ssl.patch           |   17 -
 .../pdo_reset_error_beginTransaction.patch         |   16 -
 debian/patches/upstream/soap_mem_leak.patch        |   16 -
 debian/patches/use_system_crypt_fixes.patch        |   10 +-
 debian/patches/zend_int_overflow.patch             |    4 +-
 debian/php5-fpm.init                               |   58 +++
 debian/php5-fpm.postinst                           |   15 +
 debian/rules                                       |   62 +++-
 36 files changed, 568 insertions(+), 1100 deletions(-)
 delete mode 100644 .gitignore
 mode change 100755 => 100644 debian/maxlifetime
 delete mode 100644 debian/patches/CVE-2010-0397.patch
 delete mode 100644 debian/patches/bad_whatis_entries.patch
 delete mode 100644 debian/patches/enchant_unaligned_memory_access.patch
 delete mode 100644 debian/patches/filter_validate_int.patch
 delete mode 100644 debian/patches/fix_broken_gd_bundled-specific_tests.patch
 delete mode 100644 debian/patches/fix_broken_locale_tests.patch
 delete mode 100644 debian/patches/fix_var_dump_64bit.phpt.patch
 create mode 100644 debian/patches/fpm-config.patch
 create mode 100644 debian/patches/fpm_gcc_atomics.patch
 create mode 100644 debian/patches/php-fpm-man-section-and-cleanup.patch
 delete mode 100644 debian/patches/upstream/SplFileInfo_getPathName_parent.patch
 delete mode 100644 debian/patches/upstream/date_mem_leak.patch
 delete mode 100644 debian/patches/upstream/db4.8_workarounds.patch
 delete mode 100644 debian/patches/upstream/dba_unaligned_mem_access.patch
 delete mode 100644 debian/patches/upstream/define_json_error_utf8.patch
 delete mode 100644 debian/patches/upstream/gc_memory_leak.patch
 delete mode 100644 debian/patches/upstream/incorrect_SplFileInfo_fscanf_prototype.patch
 delete mode 100644 debian/patches/upstream/incorrect_docroot_eval.patch
 delete mode 100644 debian/patches/upstream/mssql_per_query_timeout.patch
 delete mode 100644 debian/patches/upstream/multiple_typos.patch
 delete mode 100644 debian/patches/upstream/mysqli_options_mem_issue.patch
 delete mode 100644 debian/patches/upstream/mysqli_ssl.patch
 delete mode 100644 debian/patches/upstream/pdo_reset_error_beginTransaction.patch
 delete mode 100644 debian/patches/upstream/soap_mem_leak.patch
 create mode 100644 debian/php5-fpm.init
 create mode 100644 debian/php5-fpm.postinst
 mode change 100755 => 100644 debian/setup-mysql.sh

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index 133c9b3..0000000
--- a/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-.pc/
\ No newline at end of file
diff --git a/debian/changelog b/debian/changelog
index 80a4556..e0fc2a0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+php5 (5.3.3-1) experimental; urgency=low
+
+  * Upload PHP 5.3.3 to experimental for further testing
+    + Fixes odbc_autocommit (Closes: #586570)
+    + Adds support for sqlite3_busy_timout (Closes: #589473)
+    + Fixes CVE-2010-2225, CVE-2010-2094, CVE-2010-1917, CVE-2010-1866
+      and other CVEs that do not apply to the Debian packages or are
+      irrelevant as per the pre-5.3.2-2 security policy.
+  * Changes pending update from unstable:
+    + Use system crypt
+  * Build the FPM SAPI.
+
+ -- Raphael Geissert <geissert at debian.org>  Sat, 31 Jul 2010 15:53:12 -0400
+
 php5 (5.3.2-2) unstable; urgency=low
 
   [ Ondřej Surý ]
diff --git a/debian/control b/debian/control
index 408cd96..cf1e8bc 100644
--- a/debian/control
+++ b/debian/control
@@ -22,6 +22,7 @@ Build-Depends: apache2-prefork-dev,
 	       libcurl4-openssl-dev | libcurl-dev,
 	       libdb-dev (>= 4.7) | libdb4.8-dev | libdb4.6-dev,
 	       libenchant-dev,
+	       libevent-dev (>= 1.4.11),
 	       libexpat1-dev (>= 1.95.2-2.1),
 	       libfreetype6-dev,
 	       libgcrypt11-dev,
@@ -72,10 +73,10 @@ Homepage: http://www.php.net/
 
 Package: php5
 Architecture: all
-Depends: ${misc:Depends}, libapache2-mod-php5 (>= ${source:Version}) | libapache2-mod-php5filter (>= ${source:Version}) | php5-cgi (>= ${source:Version}), php5-common (>= ${source:Version})
+Depends: ${misc:Depends}, libapache2-mod-php5 (>= ${source:Version}) | libapache2-mod-php5filter (>= ${source:Version}) | php5-cgi (>= ${source:Version}) | php5-fpm (>= ${source:Version}), php5-common (>= ${source:Version})
 Description: server-side, HTML-embedded scripting language (metapackage)
  This package is a metapackage that, when installed, guarantees that you
- have at least one of the three server-side versions of the PHP5 interpreter
+ have at least one of the four server-side versions of the PHP5 interpreter
  installed. Removing this package won't remove PHP5 from your system, however
  it may remove other packages that depend on this one.
  .
@@ -175,6 +176,23 @@ Description: command-line interpreter for the php5 scripting language
  in. The goal of the language is to allow web developers to write dynamically
  generated pages quickly. This version of PHP5 was built with the Suhosin patch.
 
+Package: php5-fpm
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, mime-support, php5-common (= ${binary:Version}), libmagic1, ucf, tzdata
+Provides: ${php:Provides}
+Suggests: php-pear
+Description: server-side, HTML-embedded scripting language (FPM-CGI binary)
+ This package provides the Fast Process Manager interpreter that runs
+ as a daemon and receives Fast/CGI requests.  Note that MOST Apache users
+ probably want the libapache2-mod-php5 package.
+ .
+ ${php:Extensions}
+ .
+ PHP5 is an HTML-embedded scripting language. Much of its syntax is borrowed
+ from C, Java and Perl with a couple of unique PHP-specific features thrown
+ in. The goal of the language is to allow web developers to write dynamically
+ generated pages quickly. This version of PHP5 was built with the Suhosin patch.
+
 Package: php5-dev
 Depends: ${misc:Depends}, autoconf (>= 2.63), automake (>= 1.11), libssl-dev, libtool (>= 2.2), shtool, php5-common (>= ${binary:Version})
 Conflicts: ${libtool:Conflicts}
@@ -189,7 +207,7 @@ Description: Files for PHP5 module development
  generated pages quickly. This version of PHP5 was built with the Suhosin patch.
 
 Package: php5-dbg
-Depends: ${misc:Depends}, php5-common (= ${binary:Version}), libapache2-mod-php5 (= ${binary:Version}) | libapache2-mod-php5filter (= ${binary:Version}) | php5-cgi (= ${binary:Version}) | php5-cli (= ${binary:Version}) | php5-curl (= ${binary:Version}) | php5-enchant (= ${binary:Version}) | php5-gd (= ${binary:Version}) | php5-gmp (= ${binary:Version}) | php5-imap (= ${binary:Version}) | php5-interbase (= ${binary:Version}) | php5-intl (= ${binary:Version}) | php5-ldap (= ${binary:Version}) | php5-mcrypt (= ${binary:Version}) | php5-mysql (= ${binary:Version}) | php5-odbc (= ${binary:Version}) | php5-pgsql (= ${binary:Version}) | php5-pspell (= ${binary:Version}) | php5-recode (= ${binary:Version}) | php5-snmp (= ${binary:Version}) | php5-sqlite (= ${binary:Version}) | php5-sybase (= ${binary:Version}) | php5-tidy (= ${binary:Version}) | php5-xmlrpc (= ${binary:Version}) | php5-xsl (= ${binary:Version})
+Depends: ${misc:Depends}, php5-common (= ${binary:Version}), libapache2-mod-php5 (= ${binary:Version}) | libapache2-mod-php5filter (= ${binary:Version}) | php5-cgi (= ${binary:Version}) | php5-cli (= ${binary:Version}) | php5-fpm (= ${binary:Version}) | php5-curl (= ${binary:Version}) | php5-enchant (= ${binary:Version}) | php5-gd (= ${binary:Version}) | php5-gmp (= ${binary:Version}) | php5-imap (= ${binary:Version}) | php5-interbase (= ${binary:Version}) | php5-intl (= ${binary:Version}) | php5-ldap (= ${binary:Version}) | php5-mcrypt (= ${binary:Version}) | php5-mysql (= ${binary:Version}) | php5-odbc (= ${binary:Version}) | php5-pgsql (= ${binary:Version}) | php5-pspell (= ${binary:Version}) | php5-recode (= ${binary:Version}) | php5-snmp (= ${binary:Version}) | php5-sqlite (= ${binary:Version}) | php5-sybase (= ${binary:Version}) | php5-tidy (= ${binary:Version}) | php5-xmlrpc (= ${binary:Version}) | php5-xsl (= ${binary:Version})
 Recommends: gdb
 Section: debug
 Priority: extra
diff --git a/debian/maxlifetime b/debian/maxlifetime
old mode 100755
new mode 100644
diff --git a/debian/patches/036-fd_setsize_fix.patch b/debian/patches/036-fd_setsize_fix.patch
index 0adda07..c740c07 100644
--- a/debian/patches/036-fd_setsize_fix.patch
+++ b/debian/patches/036-fd_setsize_fix.patch
@@ -3,8 +3,10 @@ Origin: vendor
 Forwarded: no
 Last-Update: 2010-01-18
 
---- a/ext/sockets/sockets.c
-+++ b/ext/sockets/sockets.c
+Index: php-5.3.3RC3/ext/sockets/sockets.c
+===================================================================
+--- php-5.3.3RC3.orig/ext/sockets/sockets.c
++++ php-5.3.3RC3/ext/sockets/sockets.c
 @@ -720,6 +720,7 @@ static int php_sock_array_to_fd_set(zval
  
  		php_sock = (php_socket*) zend_fetch_resource(element TSRMLS_CC, -1, le_socket_name, NULL, 1, le_socket);
@@ -13,15 +15,16 @@ Last-Update: 2010-01-18
  
  		PHP_SAFE_FD_SET(php_sock->bsd_socket, fds);
  		if (php_sock->bsd_socket > *max_fd) {
---- a/ext/standard/streamsfuncs.c
-+++ b/ext/standard/streamsfuncs.c
-@@ -610,6 +610,9 @@ static int stream_array_to_fd_set(zval *
+Index: php-5.3.3RC3/ext/standard/streamsfuncs.c
+===================================================================
+--- php-5.3.3RC3.orig/ext/standard/streamsfuncs.c
++++ php-5.3.3RC3/ext/standard/streamsfuncs.c
+@@ -610,6 +610,8 @@ static int stream_array_to_fd_set(zval *
  		 * is not displayed.
  		 * */
  		if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT | PHP_STREAM_CAST_INTERNAL, (void*)&this_fd, 1) && this_fd >= 0) {
 +			if (this_fd > FD_SETSIZE)
 +				continue;
-+
- 			
+ 
  			PHP_SAFE_FD_SET(this_fd, fds);
  
diff --git a/debian/patches/CVE-2010-0397.patch b/debian/patches/CVE-2010-0397.patch
deleted file mode 100644
index ce53c39..0000000
--- a/debian/patches/CVE-2010-0397.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-Description: Fix a null pointer dereference when processing invalid
- XML-RPC requests.
-Origin: vendor
-Forwarded: http://bugs.php.net/51288
-Last-Update: 2010-03-12
-
-Index: php/ext/xmlrpc/xmlrpc-epi-php.c
-===================================================================
---- php.orig/ext/xmlrpc/xmlrpc-epi-php.c
-+++ php/ext/xmlrpc/xmlrpc-epi-php.c
-@@ -778,6 +778,7 @@ zval* decode_request_worker(char *xml_in
- 	zval* retval = NULL;
- 	XMLRPC_REQUEST response;
- 	STRUCT_XMLRPC_REQUEST_INPUT_OPTIONS opts = {{0}};
-+	const char *method_name;
- 	opts.xml_elem_opts.encoding = encoding_in ? utf8_get_encoding_id_from_string(encoding_in) : ENCODING_DEFAULT;
- 
- 	/* generate XMLRPC_REQUEST from raw xml */
-@@ -788,10 +789,16 @@ zval* decode_request_worker(char *xml_in
- 
- 		if (XMLRPC_RequestGetRequestType(response) == xmlrpc_request_call) {
- 			if (method_name_out) {
--				zval_dtor(method_name_out);
--				Z_TYPE_P(method_name_out) = IS_STRING;
--				Z_STRVAL_P(method_name_out) = estrdup(XMLRPC_RequestGetMethodName(response));
--				Z_STRLEN_P(method_name_out) = strlen(Z_STRVAL_P(method_name_out));
-+				method_name = XMLRPC_RequestGetMethodName(response);
-+				if (method_name) {
-+					zval_dtor(method_name_out);
-+					Z_TYPE_P(method_name_out) = IS_STRING;
-+					Z_STRVAL_P(method_name_out) = estrdup(method_name);
-+					Z_STRLEN_P(method_name_out) = strlen(Z_STRVAL_P(method_name_out));
-+				} else if (retval) {
-+					zval_ptr_dtor(&retval);
-+					retval = NULL;
-+				}
- 			}
- 		}
- 
-Index: php/ext/xmlrpc/tests/bug51288.phpt
-===================================================================
---- /dev/null
-+++ php/ext/xmlrpc/tests/bug51288.phpt
-@@ -0,0 +1,14 @@
-+--TEST--
-+Bug #51288 (CVE-2010-0397, NULL pointer deref when no <methodName> in request)
-+--FILE--
-+<?php
-+$method = NULL;
-+$req = '<?xml version="1.0"?><methodCall></methodCall>';
-+var_dump(xmlrpc_decode_request($req, $method));
-+var_dump($method);
-+echo "Done\n";
-+?>
-+--EXPECT--
-+NULL
-+NULL
-+Done
diff --git a/debian/patches/bad_whatis_entries.patch b/debian/patches/bad_whatis_entries.patch
deleted file mode 100644
index 0dc956f..0000000
--- a/debian/patches/bad_whatis_entries.patch
+++ /dev/null
@@ -1,34 +0,0 @@
-Description: Fix whatis entries of the man pages
-Origin: vendor
-Forwarded: http://bugs.php.net/50795
-Last-Update: 2010-01-18
-
---- a/sapi/cli/php.1.in
-+++ b/sapi/cli/php.1.in
-@@ -1,6 +1,5 @@
- .TH PHP 1 "2010" "The PHP Group" "Scripting Language"
- .SH NAME
--.TP 15
- php \- PHP Command Line Interface 'CLI'
- .SH SYNOPSIS
- .B php
---- a/scripts/man1/php-config.1.in
-+++ b/scripts/man1/php-config.1.in
-@@ -1,6 +1,5 @@
- .TH php\-config 1 "2006" "The PHP Group" "Scripting Language"
- .SH NAME
--.TP 15
- php\-config \- get information about PHP configuration and compile options
- .SH SYNOPSIS
- .B php\-config
---- a/scripts/man1/phpize.1.in
-+++ b/scripts/man1/phpize.1.in
-@@ -1,7 +1,6 @@
- .TH phpize 1 "2006" "The PHP Group" "Scripting Language"
- .SH NAME
--.TP 15
--phpize - prepare a PHP extension for compiling
-+phpize \- prepare a PHP extension for compiling
- .SH SYNOPSIS
- .B phpize
- [options]
diff --git a/debian/patches/enchant_unaligned_memory_access.patch b/debian/patches/enchant_unaligned_memory_access.patch
deleted file mode 100644
index 6e530d5..0000000
--- a/debian/patches/enchant_unaligned_memory_access.patch
+++ /dev/null
@@ -1,76 +0,0 @@
-Description: Fix an unaligned memory access in enchant_dict_suggest()
-Origin: vendor
-Forwarded: http://bugs.php.net/51289
-Last-Update: 2010-03-12
-
-Index: php/ext/enchant/enchant.c
-===================================================================
---- php.orig/ext/enchant/enchant.c
-+++ php/ext/enchant/enchant.c
-@@ -724,6 +724,7 @@ PHP_FUNCTION(enchant_dict_quick_check)
- 
- 	if (enchant_dict_check(pdict->pdict, word, wordlen) > 0) {
- 		int n_sugg;
-+		size_t n_sugg_st;
- 		char **suggs;
- 
- 		if (!sugg && ZEND_NUM_ARGS() == 2) {
-@@ -732,7 +733,8 @@ PHP_FUNCTION(enchant_dict_quick_check)
- 
- 		array_init(sugg);
- 
--		suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, (size_t *) &n_sugg);
-+		suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
-+		memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
- 		if (suggs && n_sugg) {
- 			int i;
- 			for (i = 0; i < n_sugg; i++) {
-@@ -777,6 +779,7 @@ PHP_FUNCTION(enchant_dict_suggest)
- 	char **suggs;
- 	enchant_dict *pdict;
- 	int n_sugg;
-+	size_t n_sugg_st;
- 
- 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &dict, &word, &wordlen) == FAILURE) {
- 		RETURN_FALSE;
-@@ -784,7 +787,8 @@ PHP_FUNCTION(enchant_dict_suggest)
- 
- 	PHP_ENCHANT_GET_DICT;
- 
--	suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, (size_t *)&n_sugg);
-+	suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st);
-+	memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));
- 	if (suggs && n_sugg) {
- 		int i;
- 
-Index: php/ext/enchant/tests/dict_quick_check.phpt
-===================================================================
---- /dev/null
-+++ php/ext/enchant/tests/dict_quick_check.phpt
-@@ -0,0 +1,26 @@
-+--TEST--
-+enchant_dict_quick_check() basic test
-+--SKIPIF--
-+<?php
-+if(!extension_loaded('enchant')) die('skip, enchant not loader');
-+
-+$tag = 'en_US';
-+$r = enchant_broker_init();
-+if (!enchant_broker_dict_exists($r, $tag))
-+    die('skip, no dictionary for ' . $tag . ' tag');
-+?>
-+--FILE--
-+<?php
-+
-+$tag = 'en_US';
-+$r = enchant_broker_init();
-+
-+$d = enchant_broker_request_dict($r, $tag);
-+enchant_dict_quick_check($d, 'soong', $suggs);
-+
-+echo "Elements: " . count($suggs) . "\n";
-+echo "Done\n";
-+?>
-+--EXPECTF--
-+Elements: %d
-+Done
diff --git a/debian/patches/filter_validate_int.patch b/debian/patches/filter_validate_int.patch
deleted file mode 100644
index 8c33995..0000000
--- a/debian/patches/filter_validate_int.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-From: Sean Finney <seanius at debian.org>
-Subject: Fix improper signed overflow detection in filter extension
-
-The existing filter code relied on detecting invalid long integers by
-examining computed values for wraparound.  This is not defined behavior
-in any C standard, and in fact recent versions of gcc will optimize out
-such checks resulting in invalid code.
-
-This patch therefore changes how the overflow/underflow conditions are
-detected, using more reliable arithmetic.  It also fixes another bug, that
-the minimum integer value (-PHP_INT_MAX)-1 could not be detected properly.
-
-This patch also includes an update to the test case that detects such
-overflows, adding much more thorough and descriptive checking.
-
-Bug: http://bugs.php.net/bug.php?id=51023
-Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570287
---- php.orig/ext/filter/logical_filters.c
-+++ php/ext/filter/logical_filters.c
-@@ -68,7 +68,7 @@
- 
- static int php_filter_parse_int(const char *str, unsigned int str_len, long *ret TSRMLS_DC) { /* {{{ */
- 	long ctx_value;
--	int sign = 0;
-+	int sign = 0, digit = 0;
- 	const char *end = str + str_len;
- 
- 	switch (*str) {
-@@ -82,7 +82,7 @@ static int php_filter_parse_int(const ch
- 
- 	/* must start with 1..9*/
- 	if (str < end && *str >= '1' && *str <= '9') {
--		ctx_value = ((*(str++)) - '0');
-+		ctx_value = ((sign)?-1:1) * ((*(str++)) - '0');
- 	} else {
- 		return -1;
- 	}
-@@ -95,19 +95,18 @@ static int php_filter_parse_int(const ch
- 
- 	while (str < end) {
- 		if (*str >= '0' && *str <= '9') {
--			ctx_value = (ctx_value * 10) + (*(str++) - '0');
-+			digit = (*(str++) - '0');
-+			if ( (!sign) && ctx_value <= (LONG_MAX-digit)/10 ) {
-+				ctx_value = (ctx_value * 10) + digit;
-+			} else if ( sign && ctx_value >= (LONG_MIN+digit)/10) {
-+				ctx_value = (ctx_value * 10) - digit;
-+			} else {
-+				return -1;
-+			}
- 		} else {
- 			return -1;
- 		}
- 	}
--	if (sign) {
--		ctx_value = -ctx_value;
--		if (ctx_value > 0) { /* overflow */
--			return -1;
--		}
--	} else if (ctx_value < 0) { /* overflow */
--		return -1;
--	}
- 
- 	*ret = ctx_value;
- 	return 1;
---- php.orig/ext/filter/tests/046.phpt
-+++ php/ext/filter/tests/046.phpt
-@@ -4,16 +4,46 @@ Integer overflow
- <?php if (!extension_loaded("filter")) die("skip"); ?>
- --FILE--
- <?php
--$s = sprintf("%d", PHP_INT_MAX);
--var_dump(is_long(filter_var($s, FILTER_VALIDATE_INT)));
-+$max = sprintf("%d", PHP_INT_MAX);
-+switch($max) {
-+case "2147483647": /* 32-bit systems */
-+	$min = "-2147483648";
-+	$overflow = "2147483648";
-+	$underflow = "-2147483649";
-+	break;
-+case "9223372036854775807": /* 64-bit systems */
-+	$min = "-9223372036854775808";
-+	$overflow = "9223372036854775808";
-+	$underflow = "-9223372036854775809";
-+	break;
-+default:
-+	die("failed: unknown value for PHP_MAX_INT");
-+	break;
-+}
- 
--$s = sprintf("%.0f", PHP_INT_MAX+1);
--var_dump(filter_var($s, FILTER_VALIDATE_INT));
-+function test_validation($val, $msg) {
-+	$f = filter_var($val, FILTER_VALIDATE_INT);
-+	echo "$msg filtered: "; var_dump($f); // filtered value (or false)
-+	echo "$msg is_long: "; var_dump(is_long($f)); // test validation
-+	echo "$msg equal: "; var_dump($val == $f); // test equality of result
-+}
- 
--$s = sprintf("%d", -PHP_INT_MAX);
--var_dump(is_long(filter_var($s, FILTER_VALIDATE_INT)));
-+// PHP_INT_MAX
-+test_validation($max, "max");
-+test_validation($overflow, "overflow");
-+test_validation($min, "min");
-+test_validation($underflow, "underflow");
- ?>
----EXPECT--
--bool(true)
--bool(false)
--bool(true)
-+--EXPECTF--
-+max filtered: int(%d)
-+max is_long: bool(true)
-+max equal: bool(true)
-+overflow filtered: bool(false)
-+overflow is_long: bool(false)
-+overflow equal: bool(false)
-+min filtered: int(-%d)
-+min is_long: bool(true)
-+min equal: bool(true)
-+underflow filtered: bool(false)
-+underflow is_long: bool(false)
-+underflow equal: bool(false)
diff --git a/debian/patches/fix_broken_gd_bundled-specific_tests.patch b/debian/patches/fix_broken_gd_bundled-specific_tests.patch
deleted file mode 100644
index fa0ad62..0000000
--- a/debian/patches/fix_broken_gd_bundled-specific_tests.patch
+++ /dev/null
@@ -1,92 +0,0 @@
-Description: Backport upstream fix for tests that require the bundled 
- gd library but are not skipped in case the external library is used.
-Origin: upstream
-
-Index: php/ext/gd/tests/bug42434.phpt
-===================================================================
---- php.orig/ext/gd/tests/bug42434.phpt
-+++ php/ext/gd/tests/bug42434.phpt
-@@ -5,6 +5,7 @@ Bug #42434 (ImageLine w/ antialias = 1px
- if (!extension_loaded('gd')) {
- 	die('skip gd extension not available');
- }
-+if (!GD_BUNDLED) die("skip requires bundled GD library\n");
- ?>
- --FILE--
- <?php
-Index: php/ext/gd/tests/imageantialias_error1.phpt
-===================================================================
---- php.orig/ext/gd/tests/imageantialias_error1.phpt
-+++ php/ext/gd/tests/imageantialias_error1.phpt
-@@ -6,6 +6,7 @@ Guilherme Blanco <guilhermeblanco [at] h
- --SKIPIF--
- <?php 
- if (!extension_loaded("gd")) die("skip GD not present");
-+if (!GD_BUNDLED) die("skip requires bundled GD library\n");
- ?>
- --FILE--
- <?php
-Index: php/ext/gd/tests/imageantialias_error2.phpt
-===================================================================
---- php.orig/ext/gd/tests/imageantialias_error2.phpt
-+++ php/ext/gd/tests/imageantialias_error2.phpt
-@@ -6,6 +6,7 @@ Guilherme Blanco <guilhermeblanco [at] h
- --SKIPIF--
- <?php 
- if (!extension_loaded("gd")) die("skip GD not present");
-+if (!GD_BUNDLED) die("skip requires bundled GD library\n");
- ?>
- --FILE--
- <?php
-Index: php/ext/gd/tests/imagelayereffect_basic.phpt
-===================================================================
---- php.orig/ext/gd/tests/imagelayereffect_basic.phpt
-+++ php/ext/gd/tests/imagelayereffect_basic.phpt
-@@ -6,7 +6,7 @@ Rafael Dohms <rdohms [at] gmail [dot] co
- --SKIPIF--
- <?php 
- 	if (!extension_loaded("gd")) die("skip GD not present");
--	if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
-+	if (!GD_BUNDLED) die('skip function only available in bundled, external GD detected');
- ?>
- --FILE--
- <?php
-Index: php/ext/gd/tests/imagelayereffect_error1.phpt
-===================================================================
---- php.orig/ext/gd/tests/imagelayereffect_error1.phpt
-+++ php/ext/gd/tests/imagelayereffect_error1.phpt
-@@ -6,7 +6,7 @@ Rafael Dohms <rdohms [at] gmail [dot] co
- --SKIPIF--
- <?php 
- 	if (!extension_loaded("gd")) die("skip GD not present");
--	if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
-+	if (!GD_BUNDLED) die('skip function only available in bundled, external GD detected');
- ?>
- --FILE--
- <?php
-Index: php/ext/gd/tests/imagelayereffect_error2.phpt
-===================================================================
---- php.orig/ext/gd/tests/imagelayereffect_error2.phpt
-+++ php/ext/gd/tests/imagelayereffect_error2.phpt
-@@ -6,7 +6,7 @@ Rafael Dohms <rdohms [at] gmail [dot] co
- --SKIPIF--
- <?php 
- 	if (!extension_loaded("gd")) die("skip GD not present");
--	if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
-+	if (!GD_BUNDLED) die('skip function only available in bundled, external GD detected');
- ?>
- --FILE--
- <?php
-Index: php/ext/gd/tests/imagelayereffect_error3.phpt
-===================================================================
---- php.orig/ext/gd/tests/imagelayereffect_error3.phpt
-+++ php/ext/gd/tests/imagelayereffect_error3.phpt
-@@ -6,7 +6,7 @@ Rafael Dohms <rdohms [at] gmail [dot] co
- --SKIPIF--
- <?php 
- 	if (!extension_loaded("gd")) die("skip GD not present");
--	if (!GD_BUNDLED) die('function only available in bundled, external GD detected');
-+	if (!GD_BUNDLED) die('skip function only available in bundled, external GD detected');
- ?>
- --FILE--
- <?php
diff --git a/debian/patches/fix_broken_locale_tests.patch b/debian/patches/fix_broken_locale_tests.patch
deleted file mode 100644
index 43c7e7a..0000000
--- a/debian/patches/fix_broken_locale_tests.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Description: Backport upstream fix for tests with incorrect locale name
-Origin: upstream
-
-Index: php/ext/standard/tests/strings/strtolower.phpt
-===================================================================
---- php.orig/ext/standard/tests/strings/strtolower.phpt
-+++ php/ext/standard/tests/strings/strtolower.phpt
-@@ -22,7 +22,7 @@ if( substr(PHP_OS, 0, 3) == 'WIN') {
- if( substr(PHP_OS, 0, 3) == 'WIN') {
-   setlocale(LC_ALL, 'C');
- } else {
--  setlocale(LC_ALL, 'en-US.UTF-8');
-+  setlocale(LC_ALL, 'en_US.UTF-8');
- }
- 
- echo "*** Testing strtolower() with all 256 chars ***\n";
-Index: php/ext/standard/tests/strings/strtoupper1.phpt
-===================================================================
---- php.orig/ext/standard/tests/strings/strtoupper1.phpt
-+++ php/ext/standard/tests/strings/strtoupper1.phpt
-@@ -22,7 +22,7 @@ if( substr(PHP_OS, 0, 3) == 'WIN') {
- if( substr(PHP_OS, 0, 3) == 'WIN') {
-   setlocale(LC_ALL, 'C');
- } else {
--  setlocale(LC_ALL, 'en-US.UTF-8');
-+  setlocale(LC_ALL, 'en_US.UTF-8');
- }
- 
- echo "*** Testing strtoupper() with all 256 chars ***\n";
diff --git a/debian/patches/fix_var_dump_64bit.phpt.patch b/debian/patches/fix_var_dump_64bit.phpt.patch
deleted file mode 100644
index c5b4ef2..0000000
--- a/debian/patches/fix_var_dump_64bit.phpt.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-Description: Backport upstream fix for broken var_dump test
-Origin: http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/tests/general_functions/var_dump_64bit.phpt?r1=279276&r2=295009&view=patch
-Bug-Debian: http://bugs.debian.org/571772
---- php.orig/ext/standard/tests/general_functions/var_dump_64bit.phpt
-+++ php/ext/standard/tests/general_functions/var_dump_64bit.phpt
-@@ -462,8 +462,7 @@
- -- Iteration 14 --
- string(22) "1234	
- 5678
--	9100
--abcda"
-+	9100
abcda"
- 
- *** Testing var_dump() on boolean variables ***
- -- Iteration 1 --
-@@ -1303,8 +1302,7 @@ array(14) {
-   [13]=>
-   string(22) "1234	
- 5678
--	9100
--abcda"
-+	9100
abcda"
- }
- array(15) {
-   [0]=>
diff --git a/debian/patches/fpm-config.patch b/debian/patches/fpm-config.patch
new file mode 100644
index 0000000..0a5091c
--- /dev/null
+++ b/debian/patches/fpm-config.patch
@@ -0,0 +1,68 @@
+Description: Add major version number to paths and allow process pools
+ to be configured in individual files in /etc/php5/fpm/pool.d/
+Origin: vendor
+Forwarded: not-needed
+Last-Update: 2010-07-30
+
+Index: php-5.3.3/sapi/fpm/php-fpm.conf.in
+===================================================================
+--- php-5.3.3.orig/sapi/fpm/php-fpm.conf.in
++++ php-5.3.3/sapi/fpm/php-fpm.conf.in
+@@ -8,7 +8,7 @@
+ ; Include one or more files. If glob(3) exists, it is used to include a bunch of
+ ; files from a glob(3) pattern. This directive can be used everywhere in the
+ ; file.
+-;include=@EXPANDED_SYSCONFDIR@/fpm.d/*.conf
++;include=@EXPANDED_SYSCONFDIR@/php5/fpm/*.conf
+ 
+ ;;;;;;;;;;;;;;;;;;
+ ; Global Options ;
+@@ -17,11 +17,11 @@
+ [global]
+ ; Pid file
+ ; Default Value: none
+-;pid = @EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
++pid = @EXPANDED_LOCALSTATEDIR@/run/php5-fpm.pid
+ 
+ ; Error log file
+ ; Default Value: @EXPANDED_LOCALSTATEDIR@/log/php-fpm.log
+-;error_log = @EXPANDED_LOCALSTATEDIR@/log/php-fpm.log
++error_log = @EXPANDED_LOCALSTATEDIR@/log/php5-fpm.log
+ 
+ ; Log level
+ ; Possible Values: alert, error, warning, notice, debug
+@@ -61,6 +61,10 @@
+ ; used in logs and stats. There is no limitation on the number of pools which
+ ; FPM can handle. Your system will tell you anyway :)
+ 
++; To configure the pools it is recommended to have one .conf file per
++; pool in the following directory:
++include=@EXPANDED_SYSCONFDIR@/php5/fpm/pool.d/*.conf
++
+ ; Start a new pool named 'www'.
+ [www]
+ 
+@@ -138,12 +142,12 @@ pm.max_children = 50
+ ; The desired minimum number of idle server processes.
+ ; Note: Used only when pm is set to 'dynamic'
+ ; Note: Mandatory when pm is set to 'dynamic'
+-;pm.min_spare_servers = 5
++pm.min_spare_servers = 5
+ 
+ ; The desired maximum number of idle server processes.
+ ; Note: Used only when pm is set to 'dynamic'
+ ; Note: Mandatory when pm is set to 'dynamic'
+-;pm.max_spare_servers = 35
++pm.max_spare_servers = 35
+  
+ ; The number of requests each child process should execute before respawning.
+ ; This can be useful to work around memory leaks in 3rd party libraries. For
+@@ -234,7 +238,7 @@ pm.max_children = 50
+  
+ ; Chdir to this directory at the start. This value must be an absolute path.
+ ; Default Value: current directory or / when chroot
+-;chdir = /var/www
++chdir = /var/www
+  
+ ; Redirect worker stdout and stderr into main error log. If not set, stdout and
+ ; stderr will be redirected to /dev/null according to FastCGI specs.
diff --git a/debian/patches/fpm_gcc_atomics.patch b/debian/patches/fpm_gcc_atomics.patch
new file mode 100644
index 0000000..5315e3d
--- /dev/null
+++ b/debian/patches/fpm_gcc_atomics.patch
@@ -0,0 +1,31 @@
+Description: Use GCC's atomic builtins in the FPM SAPI to allow it to
+ build everywhere.
+Origin: vendor
+Forwarded: http://bugs.php.net/52407
+Last-Update: 2010-07-28
+
+Index: php-5.3.3/sapi/fpm/fpm/fpm_atomic.h
+===================================================================
+--- php-5.3.3.orig/sapi/fpm/fpm/fpm_atomic.h
++++ php-5.3.3/sapi/fpm/fpm/fpm_atomic.h
+@@ -12,7 +12,19 @@
+ #endif
+ #include <sched.h>
+ 
+-#if ( __i386__ || __i386 )
++#if (__GNUC__) && (__GNUC__ >= 4 &&  __GNUC_MINOR__ >= 1)
++
++/**
++ * all the cases below (as provided by upstream) define:
++ * word as atomic_int_t, and
++ * unsigned word as atomic_uint_t
++ * and only use volatile atomic_uint_t as atomic_t
++ */
++
++typedef volatile unsigned long atomic_t;
++#define atomic_cmp_set(a,b,c) __sync_bool_compare_and_swap(a,b,c)
++
++#elif ( __i386__ || __i386 )
+ 
+ typedef int32_t                     atomic_int_t;
+ typedef uint32_t                    atomic_uint_t;
diff --git a/debian/patches/libdb_is_-ldb b/debian/patches/libdb_is_-ldb
index f5cbcc3..f6c3fc9 100644
--- a/debian/patches/libdb_is_-ldb
+++ b/debian/patches/libdb_is_-ldb
@@ -4,14 +4,16 @@ Origin: vendor
 Forwarded: no
 Last-Update: 2010-01-18
 
---- pkg-php.orig/ext/dba/config.m4
-+++ pkg-php/ext/dba/config.m4
-@@ -306,7 +306,7 @@ if test "$PHP_DB4" != "no"; then
+Index: php-5.3.3RC3/ext/dba/config.m4
+===================================================================
+--- php-5.3.3RC3.orig/ext/dba/config.m4
++++ php-5.3.3RC3/ext/dba/config.m4
+@@ -323,7 +323,7 @@ if test "$PHP_DB4" != "no"; then
        break
      fi
    done
--  PHP_DBA_DB_CHECK(4, db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
-+  PHP_DBA_DB_CHECK(4, db db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
+-  PHP_DBA_DB_CHECK(4, db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
++  PHP_DBA_DB_CHECK(4, db db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
  fi
  PHP_DBA_STD_RESULT(db4,Berkeley DB4)
  
diff --git a/debian/patches/php-fpm-man-section-and-cleanup.patch b/debian/patches/php-fpm-man-section-and-cleanup.patch
new file mode 100644
index 0000000..ba2b2b9
--- /dev/null
+++ b/debian/patches/php-fpm-man-section-and-cleanup.patch
@@ -0,0 +1,46 @@
+Description: Fix php-fpm's manpage section to match location of binary
+ (/usr/sbin,) additionally, remove some stuff that is useless or
+ doesn't apply to Debian.
+Origin: vendor
+Forwarded: http://bugs.php.net/52476
+Last-Update: 2010-07-29
+
+Index: php-5.3.3/sapi/fpm/php-fpm.1.in
+===================================================================
+--- php-5.3.3.orig/sapi/fpm/php-fpm.1.in
++++ php-5.3.3/sapi/fpm/php-fpm.1.in
+@@ -1,4 +1,4 @@
+-.TH PHP-FPM 1 "2009" "The PHP Group" "Scripting Language"
++.TH PHP-FPM 8 "2009" "The PHP Group" "Scripting Language"
+ .SH NAME
+ .TP 15
+ php-fpm \- PHP FastCGI Process Manager 'PHP-FPM'
+@@ -99,15 +99,8 @@ The configuration file for the php-fpm d
+ .TP
+ .B php.ini
+ The standard php configuration file.
+-.SH EXAMPLES
+-You should use the init script provided to start and stop the php-fpm daemon. This situation applies for any unix systems which use init.d for their main process manager.
+-.P
+-.PD 1
+-.RS
+-sudo /etc/init.d/php-fpm start
+-.RE
+-.TP
+-If your installation has no appropriate init script, launch php-fpm with no arguments. It will launch as a daemon (background process) by default. The file @php_fpm_localstatedir@/run/php-fpm.pid determines whether php-fpm is already up and running. Once started, php-fpm then responds to several POSIX signals:
++.SH SIGNALS
++Once started, php-fpm then responds to several POSIX signals:
+ .P
+ .PD 0
+ .RS
+@@ -121,10 +114,6 @@ If your installation has no appropriate
+ .RE
+ .PD 1
+ .P
+-.SH TIPS
+-The PHP-FPM CGI daemon will work well with most popular webservers, including Apache2, lighttpd and nginx.
+-.PD 1
+-.P
+ .SH SEE ALSO
+ The PHP-FPM website:
+ .PD 0
diff --git a/debian/patches/series b/debian/patches/series
index 52c5e1c..ee44a66 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -30,7 +30,6 @@ suhosin.patch
 fix_broken_upstream_tests.patch
 use_embedded_timezonedb.patch
 force_libmysqlclient_r.patch
-bad_whatis_entries.patch
 gentoo/009_ob-memory-leaks.patch
 mssql-null-exception.patch
 sybase-alias.patch
@@ -39,34 +38,19 @@ strcmp_null-OnUpdateErrorLog.patch
 unaligned_memory_access.patch
 fix_broken_5.3_tests.patch
 dont-gitclean-in-build.patch
-broken_5.3_test-posix_uname.patch
+#broken_5.3_test-posix_uname.patch
 shtool_mkdir_-p_-race-condition.patch
 qdbm-is-usr_include_qdbm.patch
-filter_validate_int.patch
 zend_int_overflow.patch
-fix_var_dump_64bit.phpt.patch
 use_embedded_timezonedb_fixes.patch
 fix_broken_sha2_test.patch
-php_crypt_revamped.patch
-fix_broken_locale_tests.patch
-fix_broken_gd_bundled-specific_tests.patch
-CVE-2010-0397.patch
-enchant_unaligned_memory_access.patch
-use_system_crypt_fixes.patch
-upstream/mysqli_ssl.patch
-upstream/pdo_reset_error_beginTransaction.patch
-upstream/define_json_error_utf8.patch
-upstream/SplFileInfo_getPathName_parent.patch
-upstream/gc_memory_leak.patch
-upstream/date_mem_leak.patch
-upstream/dba_unaligned_mem_access.patch
-upstream/mysqli_options_mem_issue.patch
+# FIXME: needs to be updated:
+#php_crypt_revamped.patch
+# FIXME: needs to be updated:
+#use_system_crypt_fixes.patch
 session_save_path.patch
-upstream/multiple_typos.patch
-upstream/db4.8_workarounds.patch
-upstream/mssql_per_query_timeout.patch
-upstream/incorrect_docroot_eval.patch
-upstream/soap_mem_leak.patch
-upstream/incorrect_SplFileInfo_fscanf_prototype.patch
-install-programs_parallel_FTBFS.patch
-581911_pdo_mysql_segfaults.patch
+#install-programs_parallel_FTBFS.patch
+#581911_pdo_mysql_segfaults.patch
+fpm_gcc_atomics.patch
+php-fpm-man-section-and-cleanup.patch
+fpm-config.patch
diff --git a/debian/patches/suhosin.patch b/debian/patches/suhosin.patch
index 2f0ae3b..c427a52 100644
--- a/debian/patches/suhosin.patch
+++ b/debian/patches/suhosin.patch
@@ -9,8 +9,10 @@ the following modifications have been made:
  * removed changes to ./configure & ./main/php_config.h.in since those
    files are autogenerated
  * "quilt refresh" has been run to clean up the offsets, etc
---- a/Zend/Makefile.am
-+++ b/Zend/Makefile.am
+Index: php-5.3.3RC3/Zend/Makefile.am
+===================================================================
+--- php-5.3.3RC3.orig/Zend/Makefile.am
++++ php-5.3.3RC3/Zend/Makefile.am
 @@ -17,7 +17,7 @@ libZend_la_SOURCES=\
  	zend_objects_API.c zend_ts_hash.c zend_stream.c \
  	zend_default_classes.c \
@@ -20,9 +22,11 @@ the following modifications have been made:
  
  libZend_la_LDFLAGS =
  libZend_la_LIBADD = @ZEND_EXTRA_LIBS@
---- a/Zend/Zend.dsp
-+++ b/Zend/Zend.dsp
-@@ -247,6 +247,14 @@ SOURCE=.\zend_strtod.c
+Index: php-5.3.3RC3/Zend/Zend.dsp
+===================================================================
+--- php-5.3.3RC3.orig/Zend/Zend.dsp
++++ php-5.3.3RC3/Zend/Zend.dsp
+@@ -247,6 +247,14 @@ SOURCE=.\zend_strtod.c
  # End Source File
  # Begin Source File
  
@@ -37,9 +41,11 @@ the following modifications have been made:
  SOURCE=.\zend_ts_hash.c
  # End Source File
  # Begin Source File
---- a/Zend/ZendTS.dsp
-+++ b/Zend/ZendTS.dsp
-@@ -277,6 +277,14 @@ SOURCE=.\zend_strtod.c
+Index: php-5.3.3RC3/Zend/ZendTS.dsp
+===================================================================
+--- php-5.3.3RC3.orig/Zend/ZendTS.dsp
++++ php-5.3.3RC3/Zend/ZendTS.dsp
+@@ -277,6 +277,14 @@ SOURCE=.\zend_strtod.c
  # End Source File
  # Begin Source File
  
@@ -54,8 +60,10 @@ the following modifications have been made:
  SOURCE=.\zend_ts_hash.c
  # End Source File
  # Begin Source File
---- a/Zend/zend.c
-+++ b/Zend/zend.c
+Index: php-5.3.3RC3/Zend/zend.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend.c
++++ php-5.3.3RC3/Zend/zend.c
 @@ -60,6 +60,10 @@ int (*zend_vspprintf)(char **pbuf, size_
  ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
  ZEND_API char *(*zend_resolve_path)(const char *filename, int filename_len TSRMLS_DC);
@@ -142,8 +150,10 @@ the following modifications have been made:
  ZEND_INI_BEGIN()
  	ZEND_INI_ENTRY("error_reporting",				NULL,		ZEND_INI_ALL,		OnUpdateErrorReporting)
  	STD_ZEND_INI_BOOLEAN("zend.enable_gc",				"1",	ZEND_INI_ALL,		OnUpdateGCEnabled,      gc_enabled,     zend_gc_globals,        gc_globals)
---- a/Zend/zend.h
-+++ b/Zend/zend.h
+Index: php-5.3.3RC3/Zend/zend.h
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend.h
++++ php-5.3.3RC3/Zend/zend.h
 @@ -627,6 +627,9 @@ extern ZEND_API int (*zend_stream_open_f
  extern int (*zend_vspprintf)(char **pbuf, size_t max_len, const char *format, va_list ap);
  extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len TSRMLS_DC);
@@ -171,8 +181,10 @@ the following modifications have been made:
  #endif /* ZEND_H */
  
  /*
---- a/Zend/zend_alloc.c
-+++ b/Zend/zend_alloc.c
+Index: php-5.3.3RC3/Zend/zend_alloc.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_alloc.c
++++ php-5.3.3RC3/Zend/zend_alloc.c
 @@ -32,6 +32,10 @@
  # include <unistd.h>
  #endif
@@ -564,7 +576,7 @@ the following modifications have been made:
  
  		*mm_heap = *heap;
  
-@@ -1100,22 +1210,25 @@ ZEND_API zend_mm_heap *zend_mm_startup_e
+@@ -1100,15 +1210,15 @@ ZEND_API zend_mm_heap *zend_mm_startup_e
  		orig = ZEND_MM_SMALL_FREE_BUCKET(heap, 0);
  		for (i = 0; i < ZEND_MM_NUM_BUCKETS; i++) {
  			q = p;
@@ -586,18 +598,7 @@ the following modifications have been made:
  			p = (zend_mm_free_block*)((char*)p + sizeof(zend_mm_free_block*) * 2);
  			orig = (zend_mm_free_block*)((char*)orig + sizeof(zend_mm_free_block*) * 2);
  			if (mm_heap->large_free_buckets[i]) {
- 				mm_heap->large_free_buckets[i]->parent = &mm_heap->large_free_buckets[i];
- 			}
- 		}
--		mm_heap->rest_buckets[0]->next_free_block = mm_heap->rest_buckets[1]->prev_free_block = ZEND_MM_REST_BUCKET(mm_heap);
-+                tmp = SUHOSIN_MANGLE_PTR(mm_heap->rest_buckets[0]);
-+                tmp->next_free_block = SUHOSIN_MANGLE_PTR(ZEND_MM_REST_BUCKET(mm_heap));
-+                tmp = SUHOSIN_MANGLE_PTR(mm_heap->rest_buckets[1]);
-+		tmp->prev_free_block = SUHOSIN_MANGLE_PTR(ZEND_MM_REST_BUCKET(mm_heap));
- 
- 		free(heap);
- 		heap = mm_heap;
-@@ -1123,7 +1236,11 @@ ZEND_API zend_mm_heap *zend_mm_startup_e
+@@ -1123,7 +1233,11 @@ ZEND_API zend_mm_heap *zend_mm_startup_e
  	return heap;
  }
  
@@ -610,7 +611,7 @@ the following modifications have been made:
  {
  	int i;
  	size_t seg_size;
-@@ -1193,6 +1310,27 @@ ZEND_API zend_mm_heap *zend_mm_startup(v
+@@ -1193,6 +1307,27 @@ ZEND_API zend_mm_heap *zend_mm_startup(v
  	return heap;
  }
  
@@ -638,7 +639,7 @@ the following modifications have been made:
  #if ZEND_DEBUG
  static long zend_mm_find_leaks(zend_mm_segment *segment, zend_mm_block *b)
  {
-@@ -1561,7 +1699,11 @@ static int zend_mm_check_heap(zend_mm_he
+@@ -1561,7 +1696,11 @@ static int zend_mm_check_heap(zend_mm_he
  }
  #endif
  
@@ -651,7 +652,7 @@ the following modifications have been made:
  {
  	zend_mm_storage *storage;
  	zend_mm_segment *segment;
-@@ -1571,7 +1713,7 @@ ZEND_API void zend_mm_shutdown(zend_mm_h
+@@ -1571,7 +1710,7 @@ ZEND_API void zend_mm_shutdown(zend_mm_h
  	if (heap->reserve) {
  #if ZEND_DEBUG
  		if (!silent) {
@@ -660,7 +661,7 @@ the following modifications have been made:
  		}
  #endif
  		heap->reserve = NULL;
-@@ -1654,12 +1796,23 @@ ZEND_API void zend_mm_shutdown(zend_mm_h
+@@ -1654,12 +1793,23 @@ ZEND_API void zend_mm_shutdown(zend_mm_h
  		heap->size = 0;
  		heap->peak = 0;
  		if (heap->reserve_size) {
@@ -685,7 +686,7 @@ the following modifications have been made:
  static void zend_mm_safe_error(zend_mm_heap *heap,
  	const char *format,
  	size_t limit,
-@@ -1670,7 +1823,11 @@ static void zend_mm_safe_error(zend_mm_h
+@@ -1670,7 +1820,11 @@ static void zend_mm_safe_error(zend_mm_h
  	size_t size)
  {
  	if (heap->reserve) {
@@ -697,7 +698,7 @@ the following modifications have been made:
  		heap->reserve = NULL;
  	}
  	if (heap->overflow == 0) {
-@@ -1745,7 +1902,7 @@ static zend_mm_free_block *zend_mm_searc
+@@ -1745,7 +1899,7 @@ static zend_mm_free_block *zend_mm_searc
  		p = heap->large_free_buckets[index];
  		for (m = true_size << (ZEND_MM_NUM_BUCKETS - index); ; m <<= 1) {
  			if (UNEXPECTED(ZEND_MM_FREE_BLOCK_SIZE(p) == true_size)) {
@@ -706,7 +707,7 @@ the following modifications have been made:
  			} else if (ZEND_MM_FREE_BLOCK_SIZE(p) >= true_size &&
  			           ZEND_MM_FREE_BLOCK_SIZE(p) < best_size) {
  				best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
-@@ -1769,7 +1926,7 @@ static zend_mm_free_block *zend_mm_searc
+@@ -1769,7 +1923,7 @@ static zend_mm_free_block *zend_mm_searc
  
  		for (p = rst; p; p = p->child[p->child[0] != NULL]) {
  			if (UNEXPECTED(ZEND_MM_FREE_BLOCK_SIZE(p) == true_size)) {
@@ -715,7 +716,7 @@ the following modifications have been made:
  			} else if (ZEND_MM_FREE_BLOCK_SIZE(p) > true_size &&
  			           ZEND_MM_FREE_BLOCK_SIZE(p) < best_size) {
  				best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
-@@ -1778,7 +1935,7 @@ static zend_mm_free_block *zend_mm_searc
+@@ -1778,7 +1932,7 @@ static zend_mm_free_block *zend_mm_searc
  		}
  
  		if (best_fit) {
@@ -724,7 +725,7 @@ the following modifications have been made:
  		}
  		bitmap = bitmap >> 1;
  		if (!bitmap) {
-@@ -1794,9 +1951,12 @@ static zend_mm_free_block *zend_mm_searc
+@@ -1794,9 +1948,12 @@ static zend_mm_free_block *zend_mm_searc
  			best_fit = p;
  		}
  	}
@@ -738,7 +739,7 @@ the following modifications have been made:
  static void *_zend_mm_alloc_int(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
  {
  	zend_mm_free_block *best_fit;
-@@ -1806,7 +1966,7 @@ static void *_zend_mm_alloc_int(zend_mm_
+@@ -1806,7 +1963,7 @@ static void *_zend_mm_alloc_int(zend_mm_
  	size_t segment_size;
  	zend_mm_segment *segment;
  	int keep_rest = 0;
@@ -747,7 +748,7 @@ the following modifications have been made:
  	if (EXPECTED(ZEND_MM_SMALL_SIZE(true_size))) {
  		size_t index = ZEND_MM_BUCKET_INDEX(true_size);
  		size_t bitmap;
-@@ -1821,9 +1981,14 @@ static void *_zend_mm_alloc_int(zend_mm_
+@@ -1821,9 +1978,14 @@ static void *_zend_mm_alloc_int(zend_mm_
  			heap->cache_stat[index].count--;
  			heap->cache_stat[index].hit++;
  #endif
@@ -763,7 +764,7 @@ the following modifications have been made:
  			ZEND_MM_CHECK_MAGIC(best_fit, MEM_BLOCK_CACHED);
  			ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 0);
  			return ZEND_MM_DATA_OF(best_fit);
-@@ -1837,7 +2002,7 @@ static void *_zend_mm_alloc_int(zend_mm_
+@@ -1837,7 +1999,7 @@ static void *_zend_mm_alloc_int(zend_mm_
  		if (bitmap) {
  			/* Found some "small" free block that can be used */
  			index += zend_mm_low_bit(bitmap);
@@ -772,7 +773,7 @@ the following modifications have been made:
  #if ZEND_MM_CACHE_STAT
  			heap->cache_stat[ZEND_MM_NUM_BUCKETS].hit++;
  #endif
-@@ -1852,7 +2017,7 @@ static void *_zend_mm_alloc_int(zend_mm_
+@@ -1852,7 +2014,7 @@ static void *_zend_mm_alloc_int(zend_mm_
  	best_fit = zend_mm_search_large_block(heap, true_size);
  
  	if (!best_fit && heap->real_size >= heap->limit - heap->block_size) {
@@ -781,7 +782,7 @@ the following modifications have been made:
  		size_t best_size = -1;
  
  		while (p != ZEND_MM_REST_BUCKET(heap)) {
-@@ -1864,7 +2029,7 @@ static void *_zend_mm_alloc_int(zend_mm_
+@@ -1864,7 +2026,7 @@ static void *_zend_mm_alloc_int(zend_mm_
  				best_size = ZEND_MM_FREE_BLOCK_SIZE(p);
  				best_fit = p;
  			}
@@ -790,7 +791,7 @@ the following modifications have been made:
  		}
  	}
  
-@@ -1963,13 +2128,19 @@ zend_mm_finished_searching_for_block:
+@@ -1963,13 +2125,19 @@ zend_mm_finished_searching_for_block:
  
  	ZEND_MM_SET_DEBUG_INFO(best_fit, size, 1, 1);
  
@@ -811,7 +812,7 @@ the following modifications have been made:
  	return ZEND_MM_DATA_OF(best_fit);
  }
  
-@@ -1986,19 +2157,26 @@ static void _zend_mm_free_int(zend_mm_he
+@@ -1986,19 +2154,26 @@ static void _zend_mm_free_int(zend_mm_he
  
  	mm_block = ZEND_MM_HEADER_OF(p);
  	size = ZEND_MM_BLOCK_SIZE(mm_block);
@@ -840,7 +841,7 @@ the following modifications have been made:
  		heap->cached += size;
  		ZEND_MM_SET_MAGIC(mm_block, MEM_BLOCK_CACHED);
  #if ZEND_MM_CACHE_STAT
-@@ -2034,6 +2212,9 @@ static void _zend_mm_free_int(zend_mm_he
+@@ -2034,6 +2209,9 @@ static void _zend_mm_free_int(zend_mm_he
  	HANDLE_UNBLOCK_INTERRUPTIONS();
  }
  
@@ -850,7 +851,7 @@ the following modifications have been made:
  static void *_zend_mm_realloc_int(zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
  {
  	zend_mm_block *mm_block = ZEND_MM_HEADER_OF(p);
-@@ -2043,11 +2224,18 @@ static void *_zend_mm_realloc_int(zend_m
+@@ -2043,11 +2221,18 @@ static void *_zend_mm_realloc_int(zend_m
  	void *ptr;
  
  	if (UNEXPECTED(!p) || !ZEND_MM_VALID_PTR(p)) {
@@ -869,7 +870,7 @@ the following modifications have been made:
  	ZEND_MM_CHECK_PROTECTION(mm_block);
  
  	if (UNEXPECTED(true_size < size)) {
-@@ -2079,6 +2267,11 @@ static void *_zend_mm_realloc_int(zend_m
+@@ -2079,6 +2264,11 @@ static void *_zend_mm_realloc_int(zend_m
  			HANDLE_UNBLOCK_INTERRUPTIONS();
  		}
  		ZEND_MM_SET_DEBUG_INFO(mm_block, size, 0, 0);
@@ -881,7 +882,7 @@ the following modifications have been made:
  		return p;
  	}
  
-@@ -2094,17 +2287,22 @@ static void *_zend_mm_realloc_int(zend_m
+@@ -2094,17 +2284,22 @@ static void *_zend_mm_realloc_int(zend_m
  			heap->cache_stat[index].count--;
  			heap->cache_stat[index].hit++;
  #endif
@@ -908,7 +909,7 @@ the following modifications have been made:
  #endif
  
  			heap->cached -= true_size - orig_size;
-@@ -2113,14 +2311,13 @@ static void *_zend_mm_realloc_int(zend_m
+@@ -2113,14 +2308,13 @@ static void *_zend_mm_realloc_int(zend_m
  			cache = &heap->cache[index];
  
  			((zend_mm_free_block*)mm_block)->prev_free_block = *cache;
@@ -924,7 +925,7 @@ the following modifications have been made:
  			return ptr;
  		}
  	}
-@@ -2163,6 +2360,11 @@ static void *_zend_mm_realloc_int(zend_m
+@@ -2163,6 +2357,11 @@ static void *_zend_mm_realloc_int(zend_m
  				heap->peak = heap->size;
  			}
  			HANDLE_UNBLOCK_INTERRUPTIONS();
@@ -936,7 +937,7 @@ the following modifications have been made:
  			return p;
  		} else if (ZEND_MM_IS_FIRST_BLOCK(mm_block) &&
  				   ZEND_MM_IS_GUARD_BLOCK(ZEND_MM_BLOCK_AT(next_block, ZEND_MM_FREE_BLOCK_SIZE(next_block)))) {
-@@ -2265,38 +2467,90 @@ out_of_memory:
+@@ -2265,38 +2464,74 @@ out_of_memory:
  		}
  
  		HANDLE_UNBLOCK_INTERRUPTIONS();
@@ -1012,6 +1013,18 @@ the following modifications have been made:
 +                return _zend_mm_block_size_canary((zend_mm_heap_canary *)heap, p ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
 +	}
 +
+ 	if (!ZEND_MM_VALID_PTR(p)) {
+ 		return 0;
+ 	}
+@@ -2308,6 +2543,24 @@ ZEND_API size_t _zend_mm_block_size(zend
+ 	return ZEND_MM_BLOCK_SIZE(mm_block);
+ #endif
+ }
++#else
++ZEND_API size_t _zend_mm_block_size_canary(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
++{
++	zend_mm_block *mm_block;
++
 +	if (!ZEND_MM_VALID_PTR(p)) {
 +		return 0;
 +	}
@@ -1023,24 +1036,12 @@ the following modifications have been made:
 +	return ZEND_MM_BLOCK_SIZE(mm_block);
 +#endif
 +}
-+#else
-+ZEND_API size_t _zend_mm_block_size_canary(zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-+{
-+	zend_mm_block *mm_block;
 +
- 	if (!ZEND_MM_VALID_PTR(p)) {
- 		return 0;
- 	}
-@@ -2309,6 +2563,8 @@ ZEND_API size_t _zend_mm_block_size(zend
- #endif
- }
- 
 +#endif
-+
+ 
  /**********************/
  /* Allocation Manager */
- /**********************/
-@@ -2325,6 +2581,7 @@ static int alloc_globals_id;
+@@ -2325,6 +2578,7 @@ static int alloc_globals_id;
  static zend_alloc_globals alloc_globals;
  #endif
  
@@ -1048,7 +1049,7 @@ the following modifications have been made:
  ZEND_API int is_zend_mm(TSRMLS_D)
  {
  	return AG(mm_heap)->use_zend_alloc;
-@@ -2337,7 +2594,13 @@ ZEND_API void *_emalloc(size_t size ZEND
+@@ -2337,7 +2591,13 @@ ZEND_API void *_emalloc(size_t size ZEND
  	if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) {
  		return AG(mm_heap)->_malloc(size);
  	}
@@ -1062,7 +1063,7 @@ the following modifications have been made:
  }
  
  ZEND_API void _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-@@ -2348,7 +2611,13 @@ ZEND_API void _efree(void *ptr ZEND_FILE
+@@ -2348,7 +2608,13 @@ ZEND_API void _efree(void *ptr ZEND_FILE
  		AG(mm_heap)->_free(ptr);
  		return;
  	}
@@ -1077,7 +1078,7 @@ the following modifications have been made:
  }
  
  ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-@@ -2358,7 +2627,13 @@ ZEND_API void *_erealloc(void *ptr, size
+@@ -2358,7 +2624,13 @@ ZEND_API void *_erealloc(void *ptr, size
  	if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) {
  		return AG(mm_heap)->_realloc(ptr, size);
  	}
@@ -1091,7 +1092,7 @@ the following modifications have been made:
  }
  
  ZEND_API size_t _zend_mem_block_size(void *ptr TSRMLS_DC ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
-@@ -2366,8 +2641,15 @@ ZEND_API size_t _zend_mem_block_size(voi
+@@ -2366,8 +2638,15 @@ ZEND_API size_t _zend_mem_block_size(voi
  	if (UNEXPECTED(!AG(mm_heap)->use_zend_alloc)) {
  		return 0;
  	}
@@ -1108,7 +1109,7 @@ the following modifications have been made:
  
  #if defined(__GNUC__) && defined(i386)
  
-@@ -2438,7 +2720,7 @@ static inline size_t safe_address(size_t
+@@ -2438,7 +2717,7 @@ static inline size_t safe_address(size_t
  }
  #endif
  
@@ -1117,7 +1118,7 @@ the following modifications have been made:
  ZEND_API void *_safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
  {
  	return emalloc_rel(safe_address(nmemb, size, offset));
-@@ -2551,6 +2833,7 @@ ZEND_API void shutdown_memory_manager(in
+@@ -2551,6 +2830,7 @@ ZEND_API void shutdown_memory_manager(in
  {
  	zend_mm_shutdown(AG(mm_heap), full_shutdown, silent TSRMLS_CC);
  }
@@ -1125,7 +1126,7 @@ the following modifications have been made:
  
  static void alloc_globals_ctor(zend_alloc_globals *alloc_globals TSRMLS_DC)
  {
-@@ -2575,6 +2858,7 @@ static void alloc_globals_dtor(zend_allo
+@@ -2575,6 +2855,7 @@ static void alloc_globals_dtor(zend_allo
  }
  #endif
  
@@ -1133,7 +1134,7 @@ the following modifications have been made:
  ZEND_API void start_memory_manager(TSRMLS_D)
  {
  #ifdef ZTS
-@@ -2639,6 +2923,7 @@ ZEND_API void _full_mem_check(int silent
+@@ -2639,6 +2920,7 @@ ZEND_API void _full_mem_check(int silent
  	zend_debug_alloc_output("------------------------------------------------\n");
  }
  #endif
@@ -1141,8 +1142,10 @@ the following modifications have been made:
  
  /*
   * Local variables:
---- a/Zend/zend_alloc.h
-+++ b/Zend/zend_alloc.h
+Index: php-5.3.3RC3/Zend/zend_alloc.h
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_alloc.h
++++ php-5.3.3RC3/Zend/zend_alloc.h
 @@ -203,6 +203,8 @@ END_EXTERN_C()
  
  /* Heap functions */
@@ -1152,8 +1155,10 @@ the following modifications have been made:
  
  ZEND_API zend_mm_heap *zend_mm_startup(void);
  ZEND_API void zend_mm_shutdown(zend_mm_heap *heap, int full_shutdown, int silent TSRMLS_DC);
+Index: php-5.3.3RC3/Zend/zend_alloc_canary.c
+===================================================================
 --- /dev/null
-+++ b/Zend/zend_alloc_canary.c
++++ php-5.3.3RC3/Zend/zend_alloc_canary.c
 @@ -0,0 +1,2502 @@
 +/*
 +   +----------------------------------------------------------------------+
@@ -3657,8 +3662,10 @@ the following modifications have been made:
 + * End:
 + */
 +
+Index: php-5.3.3RC3/Zend/zend_canary.c
+===================================================================
 --- /dev/null
-+++ b/Zend/zend_canary.c
++++ php-5.3.3RC3/Zend/zend_canary.c
 @@ -0,0 +1,66 @@
 +/*
 +   +----------------------------------------------------------------------+
@@ -3726,8 +3733,10 @@ the following modifications have been made:
 + * vim600: sw=4 ts=4 fdm=marker
 + * vim<600: sw=4 ts=4
 + */
---- a/Zend/zend_compile.c
-+++ b/Zend/zend_compile.c
+Index: php-5.3.3RC3/Zend/zend_compile.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_compile.c
++++ php-5.3.3RC3/Zend/zend_compile.c
 @@ -73,6 +73,11 @@ static void zend_destroy_property_info_i
  }
  /* }}} */
@@ -3740,8 +3749,10 @@ the following modifications have been made:
  static void build_runtime_defined_function_key(zval *result, const char *name, int name_length TSRMLS_DC) /* {{{ */
  {
  	char char_pos_buf[32];
---- a/Zend/zend_compile.h
-+++ b/Zend/zend_compile.h
+Index: php-5.3.3RC3/Zend/zend_compile.h
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_compile.h
++++ php-5.3.3RC3/Zend/zend_compile.h
 @@ -606,6 +606,11 @@ ZEND_API zend_bool zend_is_auto_global(c
  ZEND_API int zend_auto_global_disable_jit(const char *varname, zend_uint varname_length TSRMLS_DC);
  ZEND_API size_t zend_dirname(char *path, size_t len);
@@ -3754,8 +3765,10 @@ the following modifications have been made:
  int zendlex(znode *zendlval TSRMLS_DC);
  
  /* BEGIN: OPCODES */
---- a/Zend/zend_constants.c
-+++ b/Zend/zend_constants.c
+Index: php-5.3.3RC3/Zend/zend_constants.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_constants.c
++++ php-5.3.3RC3/Zend/zend_constants.c
 @@ -113,6 +113,76 @@ void zend_register_standard_constants(TS
  
  	REGISTER_MAIN_LONG_CONSTANT("E_ALL", E_ALL, CONST_PERSISTENT | CONST_CS);
@@ -3833,8 +3846,10 @@ the following modifications have been made:
  	/* true/false constants */
  	{
  		zend_constant c;
---- a/Zend/zend_errors.h
-+++ b/Zend/zend_errors.h
+Index: php-5.3.3RC3/Zend/zend_errors.h
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_errors.h
++++ php-5.3.3RC3/Zend/zend_errors.h
 @@ -41,6 +41,20 @@
  #define E_ALL (E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_COMPILE_WARNING | E_USER_ERROR | E_USER_WARNING | E_USER_NOTICE | E_RECOVERABLE_ERROR | E_DEPRECATED | E_USER_DEPRECATED)
  #define E_CORE (E_CORE_ERROR | E_CORE_WARNING)
@@ -3856,10 +3871,12 @@ the following modifications have been made:
  #endif /* ZEND_ERRORS_H */
  
  /*
---- a/Zend/zend_hash.c
-+++ b/Zend/zend_hash.c
+Index: php-5.3.3RC3/Zend/zend_hash.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_hash.c
++++ php-5.3.3RC3/Zend/zend_hash.c
 @@ -20,6 +20,7 @@
- /* $Id: zend_hash.c 293155 2010-01-05 20:46:53Z sebastian $ */
+ /* $Id: zend_hash.c 298914 2010-05-03 16:36:04Z felipe $ */
  
  #include "zend.h"
 +#include "zend_compile.h"
@@ -4114,7 +4131,7 @@ the following modifications have been made:
  	while (p != NULL) {
  		q = p;
  		p = p->pListNext;
-@@ -545,6 +745,7 @@ ZEND_API void zend_hash_clean(HashTable 
+@@ -545,6 +745,7 @@ ZEND_API void zend_hash_clean(HashTable
  	SET_INCONSISTENT(HT_CLEANING);
  
  	p = ht->pListHead;
@@ -4130,8 +4147,10 @@ the following modifications have been made:
  	if (ht->pDestructor) {
  		ht->pDestructor(p->pData);
  	}
---- a/Zend/zend_llist.c
-+++ b/Zend/zend_llist.c
+Index: php-5.3.3RC3/Zend/zend_llist.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_llist.c
++++ php-5.3.3RC3/Zend/zend_llist.c
 @@ -23,6 +23,194 @@
  #include "zend_llist.h"
  #include "zend_qsort.h"
@@ -4359,9 +4378,11 @@ the following modifications have been made:
  	if ((old_tail = l->tail)) {
  		if (old_tail->prev) {
  			old_tail->prev->next = NULL;
---- a/Zend/zend_operators.c
-+++ b/Zend/zend_operators.c
-@@ -152,9 +152,14 @@ ZEND_API void convert_scalar_to_number(z
+Index: php-5.3.3RC3/Zend/zend_operators.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_operators.c
++++ php-5.3.3RC3/Zend/zend_operators.c
+@@ -153,9 +153,14 @@ ZEND_API void convert_scalar_to_number(z
  		case IS_STRING:
  			{
  				char *strval;
@@ -4377,7 +4398,7 @@ the following modifications have been made:
  					ZVAL_LONG(op, 0);
  				}
  				STR_FREE(strval);
-@@ -186,7 +191,8 @@ ZEND_API void convert_scalar_to_number(z
+@@ -187,7 +192,8 @@ ZEND_API void convert_scalar_to_number(z
  	} else {														\
  		switch (Z_TYPE_P(op)) {										\
  			case IS_STRING:											\
@@ -4387,7 +4408,7 @@ the following modifications have been made:
  					if ((Z_TYPE(holder)=is_numeric_string(Z_STRVAL_P(op), Z_STRLEN_P(op), &Z_LVAL(holder), &Z_DVAL(holder), 1)) == 0) {	\
  						ZVAL_LONG(&(holder), 0);							\
  					}														\
-@@ -228,6 +234,7 @@ ZEND_API void convert_scalar_to_number(z
+@@ -229,6 +235,7 @@ ZEND_API void convert_scalar_to_number(z
  				Z_LVAL(holder) = zend_dval_to_lval(Z_DVAL_P(op));	\
  				break;												\
  			case IS_STRING:											\
@@ -4395,7 +4416,7 @@ the following modifications have been made:
  				Z_LVAL(holder) = strtol(Z_STRVAL_P(op), NULL, 10);	\
  				break;												\
  			case IS_ARRAY:											\
-@@ -270,6 +277,7 @@ ZEND_API void convert_scalar_to_number(z
+@@ -271,6 +278,7 @@ ZEND_API void convert_scalar_to_number(z
  				Z_LVAL(holder) = (Z_DVAL_P(op) ? 1 : 0);			\
  				break;												\
  			case IS_STRING:											\
@@ -4403,7 +4424,7 @@ the following modifications have been made:
  				if (Z_STRLEN_P(op) == 0								\
  					|| (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {	\
  					Z_LVAL(holder) = 0;								\
-@@ -355,6 +363,9 @@ ZEND_API void convert_to_long_base(zval 
+@@ -356,6 +364,9 @@ ZEND_API void convert_to_long_base(zval
  			{
  				char *strval = Z_STRVAL_P(op);
  
@@ -4413,7 +4434,7 @@ the following modifications have been made:
  				Z_LVAL_P(op) = strtol(strval, NULL, base);
  				STR_FREE(strval);
  			}
-@@ -415,6 +426,9 @@ ZEND_API void convert_to_double(zval *op
+@@ -416,6 +427,9 @@ ZEND_API void convert_to_double(zval *op
  			{
  				char *strval = Z_STRVAL_P(op);
  
@@ -4423,7 +4444,7 @@ the following modifications have been made:
  				Z_DVAL_P(op) = zend_strtod(strval, NULL);
  				STR_FREE(strval);
  			}
-@@ -501,8 +515,14 @@ ZEND_API void convert_to_boolean(zval *o
+@@ -502,8 +516,14 @@ ZEND_API void convert_to_boolean(zval *o
  
  				if (Z_STRLEN_P(op) == 0
  					|| (Z_STRLEN_P(op)==1 && Z_STRVAL_P(op)[0]=='0')) {
@@ -4438,7 +4459,7 @@ the following modifications have been made:
  					Z_LVAL_P(op) = 1;
  				}
  				STR_FREE(strval);
-@@ -616,6 +636,9 @@ static void convert_scalar_to_array(zval
+@@ -617,6 +637,9 @@ static void convert_scalar_to_array(zval
  	*entry = *op;
  	INIT_PZVAL(entry);
  
@@ -4448,8 +4469,10 @@ the following modifications have been made:
  	switch (type) {
  		case IS_ARRAY:
  			ALLOC_HASHTABLE(Z_ARRVAL_P(op));
---- a/Zend/zend_variables.c
-+++ b/Zend/zend_variables.c
+Index: php-5.3.3RC3/Zend/zend_variables.c
+===================================================================
+--- php-5.3.3RC3.orig/Zend/zend_variables.c
++++ php-5.3.3RC3/Zend/zend_variables.c
 @@ -34,6 +34,9 @@ ZEND_API void _zval_dtor_func(zval *zval
  		case IS_CONSTANT:
  			CHECK_ZVAL_STRING_REL(zvalue);
@@ -4470,8 +4493,10 @@ the following modifications have been made:
  			break;
  		case IS_ARRAY:
  		case IS_CONSTANT_ARRAY:
---- a/configure.in
-+++ b/configure.in
+Index: php-5.3.3RC3/configure.in
+===================================================================
+--- php-5.3.3RC3.orig/configure.in
++++ php-5.3.3RC3/configure.in
 @@ -289,6 +289,7 @@ sinclude(Zend/Zend.m4)
  sinclude(TSRM/threads.m4)
  sinclude(TSRM/tsrm.m4)
@@ -4480,7 +4505,7 @@ the following modifications have been made:
  
  dnl divert(2)
  
-@@ -1399,7 +1400,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c 
+@@ -1399,7 +1400,7 @@ PHP_ADD_SOURCES(main, main.c snprintf.c
         php_ini.c SAPI.c rfc1867.c php_content_types.c strlcpy.c \
         strlcat.c mergesort.c reentrancy.c php_variables.c php_ticks.c \
         network.c php_open_temporary_file.c php_logos.c \
@@ -4498,8 +4523,10 @@ the following modifications have been made:
  
  if test -r "$abs_srcdir/Zend/zend_objects.c"; then
    PHP_ADD_SOURCES(Zend, zend_objects.c zend_object_handlers.c zend_objects_API.c zend_default_classes.c)
---- a/ext/standard/dl.c
-+++ b/ext/standard/dl.c
+Index: php-5.3.3RC3/ext/standard/dl.c
+===================================================================
+--- php-5.3.3RC3.orig/ext/standard/dl.c
++++ php-5.3.3RC3/ext/standard/dl.c
 @@ -249,6 +249,23 @@ PHPAPI int php_load_extension(char *file
  			return FAILURE;
  		}
@@ -4524,9 +4551,11 @@ the following modifications have been made:
  	return SUCCESS;
  }
  /* }}} */
---- a/ext/standard/info.c
-+++ b/ext/standard/info.c
-@@ -867,6 +867,33 @@ PHPAPI void php_print_info(int flag TSRM
+Index: php-5.3.3RC3/ext/standard/info.c
+===================================================================
+--- php-5.3.3RC3.orig/ext/standard/info.c
++++ php-5.3.3RC3/ext/standard/info.c
+@@ -878,6 +878,33 @@ PHPAPI void php_print_info(int flag TSRM
  		
  		php_info_print_table_end();
  
@@ -4560,8 +4589,10 @@ the following modifications have been made:
  		/* Zend Engine */
  		php_info_print_box_start(0);
  		if (expose_php && !sapi_module.phpinfo_as_text) {
---- a/ext/standard/syslog.c
-+++ b/ext/standard/syslog.c
+Index: php-5.3.3RC3/ext/standard/syslog.c
+===================================================================
+--- php-5.3.3RC3.orig/ext/standard/syslog.c
++++ php-5.3.3RC3/ext/standard/syslog.c
 @@ -42,6 +42,7 @@ static void start_syslog(TSRMLS_D);
   */
  PHP_MINIT_FUNCTION(syslog)
@@ -4578,8 +4609,10 @@ the following modifications have been made:
  	BG(syslog_device)=NULL;
  
  	return SUCCESS;
---- a/main/fopen_wrappers.c
-+++ b/main/fopen_wrappers.c
+Index: php-5.3.3RC3/main/fopen_wrappers.c
+===================================================================
+--- php-5.3.3RC3.orig/main/fopen_wrappers.c
++++ php-5.3.3RC3/main/fopen_wrappers.c
 @@ -85,13 +85,8 @@ or a tightening during activation/runtim
  PHPAPI ZEND_INI_MH(OnUpdateBaseDir)
  {
@@ -4595,8 +4628,10 @@ the following modifications have been made:
  
  	if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN || stage == PHP_INI_STAGE_ACTIVATE || stage == PHP_INI_STAGE_DEACTIVATE) {
  		/* We're in a PHP_INI_SYSTEM context, no restrictions */
---- a/main/main.c
-+++ b/main/main.c
+Index: php-5.3.3RC3/main/main.c
+===================================================================
+--- php-5.3.3RC3.orig/main/main.c
++++ php-5.3.3RC3/main/main.c
 @@ -90,6 +90,9 @@
  
  #include "SAPI.h"
@@ -4651,8 +4686,10 @@ the following modifications have been made:
  	REGISTER_MAIN_LONG_CONSTANT("PHP_INT_MAX", LONG_MAX, CONST_PERSISTENT | CONST_CS);
  	REGISTER_MAIN_LONG_CONSTANT("PHP_INT_SIZE", sizeof(long), CONST_PERSISTENT | CONST_CS);
  
---- a/main/php.h
-+++ b/main/php.h
+Index: php-5.3.3RC3/main/php.h
+===================================================================
+--- php-5.3.3RC3.orig/main/php.h
++++ php-5.3.3RC3/main/php.h
 @@ -457,6 +457,10 @@ END_EXTERN_C()
  #endif
  #endif /* !XtOffsetOf */
@@ -4664,8 +4701,10 @@ the following modifications have been made:
  #endif
  
  /*
---- a/main/php_logos.c
-+++ b/main/php_logos.c
+Index: php-5.3.3RC3/main/php_logos.c
+===================================================================
+--- php-5.3.3RC3.orig/main/php_logos.c
++++ php-5.3.3RC3/main/php_logos.c
 @@ -50,6 +50,10 @@ PHPAPI int php_unregister_info_logo(char
  	return zend_hash_del(&phpinfo_logo_hash, logo_string, strlen(logo_string));
  }
@@ -4688,8 +4727,10 @@ the following modifications have been made:
  	return SUCCESS;
  }
  
---- a/main/snprintf.c
-+++ b/main/snprintf.c
+Index: php-5.3.3RC3/main/snprintf.c
+===================================================================
+--- php-5.3.3RC3.orig/main/snprintf.c
++++ php-5.3.3RC3/main/snprintf.c
 @@ -1091,7 +1091,11 @@ static int format_converter(register buf
  
  
@@ -4702,8 +4743,10 @@ the following modifications have been made:
  					goto skip_output;
  
  					/*
---- a/main/spprintf.c
-+++ b/main/spprintf.c
+Index: php-5.3.3RC3/main/spprintf.c
+===================================================================
+--- php-5.3.3RC3.orig/main/spprintf.c
++++ php-5.3.3RC3/main/spprintf.c
 @@ -698,7 +698,11 @@ static void xbuf_format_converter(smart_
  
  
@@ -4716,8 +4759,10 @@ the following modifications have been made:
  					goto skip_output;
  
  					/*
+Index: php-5.3.3RC3/main/suhosin_globals.h
+===================================================================
 --- /dev/null
-+++ b/main/suhosin_globals.h
++++ php-5.3.3RC3/main/suhosin_globals.h
 @@ -0,0 +1,61 @@
 +/*
 +   +----------------------------------------------------------------------+
@@ -4780,8 +4825,10 @@ the following modifications have been made:
 + * c-basic-offset: 4
 + * End:
 + */
+Index: php-5.3.3RC3/main/suhosin_logo.h
+===================================================================
 --- /dev/null
-+++ b/main/suhosin_logo.h
++++ php-5.3.3RC3/main/suhosin_logo.h
 @@ -0,0 +1,178 @@
 +static unsigned char suhosin_logo[] =
 +	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48"
@@ -4961,8 +5008,10 @@ the following modifications have been made:
 +	"\x21\xb6\x99\x69\xbc\x25\xb6\xdb\x6d\x18\xc2\x10\xda\x12\x94\xa1"
 +	"\x38\xc2\x53\x8c\x63\x18\xc7\x9d\xbe\x7f\xff\xd9"
 +	;
+Index: php-5.3.3RC3/main/suhosin_patch.c
+===================================================================
 --- /dev/null
-+++ b/main/suhosin_patch.c
++++ php-5.3.3RC3/main/suhosin_patch.c
 @@ -0,0 +1,470 @@
 +/*
 +   +----------------------------------------------------------------------+
@@ -5434,8 +5483,10 @@ the following modifications have been made:
 + * vim600: sw=4 ts=4 fdm=marker
 + * vim<600: sw=4 ts=4
 + */
+Index: php-5.3.3RC3/main/suhosin_patch.h
+===================================================================
 --- /dev/null
-+++ b/main/suhosin_patch.h
++++ php-5.3.3RC3/main/suhosin_patch.h
 @@ -0,0 +1,59 @@
 +/*
 +   +----------------------------------------------------------------------+
@@ -5496,8 +5547,10 @@ the following modifications have been made:
 + * c-basic-offset: 4
 + * End:
 + */
+Index: php-5.3.3RC3/main/suhosin_patch.m4
+===================================================================
 --- /dev/null
-+++ b/main/suhosin_patch.m4
++++ php-5.3.3RC3/main/suhosin_patch.m4
 @@ -0,0 +1,8 @@
 +dnl
 +dnl $Id: suhosin_patch.m4,v 1.1 2004/11/14 13:24:24 ionic Exp $
@@ -5507,9 +5560,11 @@ the following modifications have been made:
 +
 +AC_DEFINE(SUHOSIN_PATCH, 1, [Suhosin Patch])
 +
---- a/sapi/apache/mod_php5.c
-+++ b/sapi/apache/mod_php5.c
-@@ -969,7 +969,11 @@ static void php_init_handler(server_rec 
+Index: php-5.3.3RC3/sapi/apache/mod_php5.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/apache/mod_php5.c
++++ php-5.3.3RC3/sapi/apache/mod_php5.c
+@@ -969,7 +969,11 @@ static void php_init_handler(server_rec
  	{
  		TSRMLS_FETCH();
  		if (PG(expose_php)) {
@@ -5521,8 +5576,10 @@ the following modifications have been made:
  		}
  	}
  #endif
---- a/sapi/apache2filter/sapi_apache2.c
-+++ b/sapi/apache2filter/sapi_apache2.c
+Index: php-5.3.3RC3/sapi/apache2filter/sapi_apache2.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/apache2filter/sapi_apache2.c
++++ php-5.3.3RC3/sapi/apache2filter/sapi_apache2.c
 @@ -583,7 +583,11 @@ static void php_apache_add_version(apr_p
  {
  	TSRMLS_FETCH();
@@ -5535,9 +5592,11 @@ the following modifications have been made:
  	}
  }
  
---- a/sapi/apache2handler/sapi_apache2.c
-+++ b/sapi/apache2handler/sapi_apache2.c
-@@ -393,7 +393,11 @@ static void php_apache_add_version(apr_p
+Index: php-5.3.3RC3/sapi/apache2handler/sapi_apache2.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/apache2handler/sapi_apache2.c
++++ php-5.3.3RC3/sapi/apache2handler/sapi_apache2.c
+@@ -407,7 +407,11 @@ static void php_apache_add_version(apr_p
  {
  	TSRMLS_FETCH();
  	if (PG(expose_php)) {
@@ -5549,9 +5608,11 @@ the following modifications have been made:
  	}
  }
  
---- a/sapi/apache_hooks/mod_php5.c
-+++ b/sapi/apache_hooks/mod_php5.c
-@@ -1256,7 +1256,11 @@ static void php_init_handler(server_rec 
+Index: php-5.3.3RC3/sapi/apache_hooks/mod_php5.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/apache_hooks/mod_php5.c
++++ php-5.3.3RC3/sapi/apache_hooks/mod_php5.c
+@@ -1256,7 +1256,11 @@ static void php_init_handler(server_rec
  	{
  		TSRMLS_FETCH();
  		if (PG(expose_php)) {
@@ -5563,9 +5624,11 @@ the following modifications have been made:
  		}
  	}
  #endif
---- a/sapi/cgi/cgi_main.c
-+++ b/sapi/cgi/cgi_main.c
-@@ -1923,10 +1923,18 @@ consult the installation file that came 
+Index: php-5.3.3RC3/sapi/cgi/cgi_main.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/cgi/cgi_main.c
++++ php-5.3.3RC3/sapi/cgi/cgi_main.c
+@@ -1929,10 +1929,18 @@ consult the installation file that came
  								SG(headers_sent) = 1;
  								SG(request_info).no_headers = 1;
  							}
@@ -5585,9 +5648,11 @@ the following modifications have been made:
 +  #endif
  #endif
  							php_request_shutdown((void *) 0);
- 							exit_status = 0;
---- a/sapi/cli/php_cli.c
-+++ b/sapi/cli/php_cli.c
+ 							fcgi_shutdown();
+Index: php-5.3.3RC3/sapi/cli/php_cli.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/cli/php_cli.c
++++ php-5.3.3RC3/sapi/cli/php_cli.c
 @@ -831,7 +831,11 @@ int main(int argc, char *argv[])
  				}
  
@@ -5601,8 +5666,10 @@ the following modifications have been made:
  					PHP_VERSION, sapi_module.name, __DATE__, __TIME__,
  #if ZEND_DEBUG && defined(HAVE_GCOV)
  					"(DEBUG GCOV)",
---- a/sapi/litespeed/lsapi_main.c
-+++ b/sapi/litespeed/lsapi_main.c
+Index: php-5.3.3RC3/sapi/litespeed/lsapi_main.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/litespeed/lsapi_main.c
++++ php-5.3.3RC3/sapi/litespeed/lsapi_main.c
 @@ -545,11 +545,19 @@ static int cli_main( int argc, char * ar
  				break;
  			case 'v':
@@ -5623,9 +5690,11 @@ the following modifications have been made:
  #ifdef PHP_OUTPUT_NEWAPI
                      php_output_end_all(TSRMLS_C);
  #else
---- a/sapi/milter/php_milter.c
-+++ b/sapi/milter/php_milter.c
-@@ -1102,7 +1102,11 @@ int main(int argc, char *argv[])
+Index: php-5.3.3RC3/sapi/milter/php_milter.c
+===================================================================
+--- php-5.3.3RC3.orig/sapi/milter/php_milter.c
++++ php-5.3.3RC3/sapi/milter/php_milter.c
+@@ -1111,7 +1111,11 @@ int main(int argc, char *argv[])
  				}
  				SG(headers_sent) = 1;
  				SG(request_info).no_headers = 1;
@@ -5638,8 +5707,10 @@ the following modifications have been made:
  				php_end_ob_buffers(1 TSRMLS_CC);
  				exit(1);
  				break;
---- a/win32/build/config.w32
-+++ b/win32/build/config.w32
+Index: php-5.3.3RC3/win32/build/config.w32
+===================================================================
+--- php-5.3.3RC3.orig/win32/build/config.w32
++++ php-5.3.3RC3/win32/build/config.w32
 @@ -325,7 +325,7 @@ ADD_SOURCES("Zend", "zend_language_parse
  	zend_stream.c zend_iterators.c zend_interfaces.c zend_objects.c \
  	zend_object_handlers.c zend_objects_API.c \
@@ -5657,8 +5728,10 @@ the following modifications have been made:
  
  /* For snapshot builders, where can we find the additional
   * files that make up the snapshot template? */
---- a/win32/build/config.w32.h.in
-+++ b/win32/build/config.w32.h.in
+Index: php-5.3.3RC3/win32/build/config.w32.h.in
+===================================================================
+--- php-5.3.3RC3.orig/win32/build/config.w32.h.in
++++ php-5.3.3RC3/win32/build/config.w32.h.in
 @@ -151,6 +151,9 @@
  /* Win32 supports strcoll */
  #define HAVE_STRCOLL 1
diff --git a/debian/patches/upstream/SplFileInfo_getPathName_parent.patch b/debian/patches/upstream/SplFileInfo_getPathName_parent.patch
deleted file mode 100644
index 037e332..0000000
--- a/debian/patches/upstream/SplFileInfo_getPathName_parent.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Description: SplFileInfo::getPathName() should return the parent
- directory name.
-Origin: http://svn.php.net/viewvc?view=revision&revision=298647
-Last-Update: 2010-05-01
-
-Index: php/ext/spl/spl_directory.c
-===================================================================
---- php.orig/ext/spl/spl_directory.c
-+++ php/ext/spl/spl_directory.c
-@@ -1178,7 +1178,10 @@ SPL_METHOD(SplFileInfo, getPathInfo)
- 		int path_len;
- 		char *path = spl_filesystem_object_get_pathname(intern, &path_len TSRMLS_CC);
- 		if (path) {
--			spl_filesystem_object_create_info(intern, path, path_len, 1, ce, return_value TSRMLS_CC);
-+			char *dpath = estrndup(path, path_len);
-+			path_len = php_dirname(dpath, path_len);
-+			spl_filesystem_object_create_info(intern, dpath, path_len, 1, ce, return_value TSRMLS_CC);
-+			efree(dpath);
- 		}
- 	}
- 
-Index: php/ext/spl/tests/bug48361.phpt
-===================================================================
---- /dev/null
-+++ php/ext/spl/tests/bug48361.phpt
-@@ -0,0 +1,14 @@
-+--TEST--
-+SPL: Bug #48361 SpleFileInfo::getPathName should return the dirname's path
-+--FILE--
-+<?php
-+$info = new SplFileInfo(__FILE__);
-+var_dump($info->getRealPath());
-+var_dump($info->getPathInfo()->getRealPath());
-+?>
-+===DONE===
-+--EXPECTF--
-+string(%d) "%stests%sbug48361.php"
-+string(%d) "%stests"
-+===DONE===
-+
diff --git a/debian/patches/upstream/date_mem_leak.patch b/debian/patches/upstream/date_mem_leak.patch
deleted file mode 100644
index cc0645e..0000000
--- a/debian/patches/upstream/date_mem_leak.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-Description: Fix memory leak in date if the gc is enabled
-Origin: http://svn.php.net/viewvc?view=revision&revision=298222
-Last-Update: 2010-05-01
-
-Index: php/ext/date/php_date.c
-===================================================================
---- php.orig/ext/date/php_date.c
-+++ php/ext/date/php_date.c
-@@ -2081,7 +2081,7 @@ static HashTable *date_object_get_proper
- 
- 	props = dateobj->std.properties;
- 
--	if (!dateobj->time) {
-+	if (!dateobj->time || GC_G(gc_active)) {
- 		return props;
- 	}
- 
-@@ -2224,7 +2224,7 @@ static HashTable *date_object_get_proper
- 
- 	props = intervalobj->std.properties;
- 
--	if (!intervalobj->initialized) {
-+	if (!intervalobj->initialized || GC_G(gc_active)) {
- 		return props;
- 	}
- 
-Index: php/ext/date/tests/bug49700.phpt
-===================================================================
---- /dev/null
-+++ php/ext/date/tests/bug49700.phpt
-@@ -0,0 +1,15 @@
-+--TEST--
-+Bug #49700 (memory leaks in php_date.c if garbage collector is enabled)
-+--INI--
-+date.timezone=GMT
-+--FILE--
-+<?php
-+gc_enable();
-+$objs = array();
-+$objs[1] = new DateTime();
-+gc_collect_cycles();
-+unset($objs);
-+echo "OK\n";
-+?>
-+--EXPECT--
-+OK
diff --git a/debian/patches/upstream/db4.8_workarounds.patch b/debian/patches/upstream/db4.8_workarounds.patch
deleted file mode 100644
index 7b16812..0000000
--- a/debian/patches/upstream/db4.8_workarounds.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-Description: Workaround bc changes in BDB 4.8.26
-Origin: http://svn.php.net/viewvc?view=revision&revision=295847
-Last-Update: 2010-05-02
-
-Index: php/ext/dba/dba_db4.c
-===================================================================
---- php.orig/ext/dba/dba_db4.c
-+++ php/ext/dba/dba_db4.c
-@@ -43,7 +43,19 @@ static void php_dba_db4_errcall_fcn(
- 	const char *errpfx, const char *msg)
- {
- 	TSRMLS_FETCH();
--	
-+
-+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR == 8 && DB_VERSION_PATCH <= 26) 
-+/* Bug 51086, Berkeley DB 4.8.26 */
-+/* This code suppresses a BDB 4.8 error message that BDB incorrectly emits */
-+	{
-+		char *function = get_active_function_name(TSRMLS_C);
-+		if (function && (!strcmp(function,"dba_popen") || !strcmp(function,"dba_open"))
-+			&& !strncmp(msg, "fop_read_meta", sizeof("fop_read_meta")-1)) {
-+			return;
-+		}
-+	}
-+#endif
-+
- 	php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%s%s", errpfx?errpfx:"", msg);
- }
- 
-@@ -67,6 +79,7 @@ DBA_OPEN_FUNC(db4)
- 	struct stat check_stat;
- 	int s = VCWD_STAT(info->path, &check_stat);
- 
-+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR <= 7)  /* Bug 51086 */
- 	if (!s && !check_stat.st_size) {
- 		info->mode = DBA_TRUNC; /* force truncate */
- 	}
-@@ -80,6 +93,20 @@ DBA_OPEN_FUNC(db4)
- 		(info->mode == DBA_CREAT && !s) ? 0 :
- 		info->mode == DBA_WRITER ? 0         : 
- 		info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
-+#else
-+	if (!s && !check_stat.st_size) {
-+		info->mode = DBA_CREAT; /* force creation */
-+	}
-+
-+	type = info->mode == DBA_READER ? DB_UNKNOWN :
-+		(info->mode == DBA_TRUNC || info->mode == DBA_CREAT) ? DB_BTREE :
-+		s ? DB_BTREE : DB_UNKNOWN;
-+	  
-+	gmode = info->mode == DBA_READER ? DB_RDONLY :
-+		info->mode == DBA_CREAT ? DB_CREATE : 
-+		info->mode == DBA_WRITER ? 0         : 
-+		info->mode == DBA_TRUNC ? DB_CREATE | DB_TRUNCATE : -1;
-+#endif
- 
- 	if (gmode == -1) {
- 		return FAILURE; /* not possible */
diff --git a/debian/patches/upstream/dba_unaligned_mem_access.patch b/debian/patches/upstream/dba_unaligned_mem_access.patch
deleted file mode 100644
index 2a352ac..0000000
--- a/debian/patches/upstream/dba_unaligned_mem_access.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Description: Fix an unaligned memory access in the dba extension
-Origin: http://svn.php.net/viewvc?view=revision&revision=295764
-Last-Update: 2010-05-01
-
-Index: php/ext/dba/dba.c
-===================================================================
---- php.orig/ext/dba/dba.c
-+++ php/ext/dba/dba.c
-@@ -250,7 +250,7 @@ static size_t php_dba_make_key(zval *key
- 	zval *key;													\
- 	char *key_str, *key_free;									\
- 	size_t key_len; 											\
--	int skip = 0;  												\
-+	long skip = 0;  											\
- 	switch(ac) {												\
- 	case 2: 													\
- 		if (zend_parse_parameters(ac TSRMLS_CC, "zr", &key, &id) == FAILURE) { \
diff --git a/debian/patches/upstream/define_json_error_utf8.patch b/debian/patches/upstream/define_json_error_utf8.patch
deleted file mode 100644
index d5107ec..0000000
--- a/debian/patches/upstream/define_json_error_utf8.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Add missing definition of JSON_ERROR_UTF8
-Origin: http://svn.php.net/viewvc?view=revision&revision=298145
-Last-Update: 2010-05-01
-
-Index: php/ext/json/json.c
-===================================================================
---- php.orig/ext/json/json.c
-+++ php/ext/json/json.c
-@@ -87,6 +87,7 @@ static PHP_MINIT_FUNCTION(json)
- 	REGISTER_LONG_CONSTANT("JSON_ERROR_STATE_MISMATCH", PHP_JSON_ERROR_STATE_MISMATCH, CONST_CS | CONST_PERSISTENT);
- 	REGISTER_LONG_CONSTANT("JSON_ERROR_CTRL_CHAR", PHP_JSON_ERROR_CTRL_CHAR, CONST_CS | CONST_PERSISTENT);
- 	REGISTER_LONG_CONSTANT("JSON_ERROR_SYNTAX", PHP_JSON_ERROR_SYNTAX, CONST_CS | CONST_PERSISTENT);
-+	REGISTER_LONG_CONSTANT("JSON_ERROR_UTF8", PHP_JSON_ERROR_UTF8, CONST_CS | CONST_PERSISTENT);
- 
- 	return SUCCESS;
- }
diff --git a/debian/patches/upstream/gc_memory_leak.patch b/debian/patches/upstream/gc_memory_leak.patch
deleted file mode 100644
index cd2238a..0000000
--- a/debian/patches/upstream/gc_memory_leak.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Fix memory leak in cyclical garbage collector
-Origin: http://svn.php.net/viewvc?view=revision&revision=298213
-Last-Update: 2010-05-01
-
-Index: php/Zend/zend_execute.c
-===================================================================
---- php.orig/Zend/zend_execute.c
-+++ php/Zend/zend_execute.c
-@@ -708,6 +708,7 @@ static inline zval* zend_assign_to_varia
- 				return variable_ptr;
- 			}
- 		} else { /* we need to split */
-+			GC_ZVAL_CHECK_POSSIBLE_ROOT(*variable_ptr_ptr);
- 			if (!is_tmp_var) {
- 				if (PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) > 0) {
- 					ALLOC_ZVAL(variable_ptr);
diff --git a/debian/patches/upstream/incorrect_SplFileInfo_fscanf_prototype.patch b/debian/patches/upstream/incorrect_SplFileInfo_fscanf_prototype.patch
deleted file mode 100644
index 280eff7..0000000
--- a/debian/patches/upstream/incorrect_SplFileInfo_fscanf_prototype.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-Description: Fix the prototype of SplFileInfo::fscanf so that it can be
- extended.
-Origin: http://svn.php.net/viewvc?view=revision&revision=298475
-Last-Update: 2010-05-02
-
-Index: php/ext/spl/spl_directory.c
-===================================================================
---- php.orig/ext/spl/spl_directory.c
-+++ php/ext/spl/spl_directory.c
-@@ -2570,9 +2570,8 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_file_obje
- 	ZEND_ARG_INFO(0, allowable_tags)
- ZEND_END_ARG_INFO()
- 
--ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 1, 0, 1) 
-+ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fscanf, 0, 0, 1) 
- 	ZEND_ARG_INFO(0, format)
--	ZEND_ARG_INFO(1, ...)
- ZEND_END_ARG_INFO()
- 
- ZEND_BEGIN_ARG_INFO_EX(arginfo_file_object_fwrite, 0, 0, 1) 
-Index: php/ext/spl/tests/bug51532.phpt
-===================================================================
---- /dev/null
-+++ php/ext/spl/tests/bug51532.phpt
-@@ -0,0 +1,14 @@
-+--TEST--
-+SPL: Allow valid extension of SplFileObject::fscanf
-+--FILE--
-+<?php
-+
-+class A extends SplFileObject {
-+    public function fscanf($format) {
-+
-+    }
-+}
-+?>
-+===DONE===
-+--EXPECT--
-+===DONE===
diff --git a/debian/patches/upstream/incorrect_docroot_eval.patch b/debian/patches/upstream/incorrect_docroot_eval.patch
deleted file mode 100644
index 47049be..0000000
--- a/debian/patches/upstream/incorrect_docroot_eval.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Description: Correctly determine the length of doc_root for its
- evaluation.
-Origin: http://svn.php.net/viewvc?view=revision&revision=298277
-Last-Update: 2010-05-02
-
-Index: php/main/fopen_wrappers.c
-===================================================================
---- php.orig/main/fopen_wrappers.c
-+++ php/main/fopen_wrappers.c
-@@ -430,8 +430,8 @@ PHPAPI int php_fopen_primary_script(zend
- 		}
- 	} else
- #endif
--	if (PG(doc_root) && path_info && (length = strlen(PG(doc_root)) &&
--		IS_ABSOLUTE_PATH(PG(doc_root), length))) {
-+	if (PG(doc_root) && path_info && (length = strlen(PG(doc_root))) &&
-+		IS_ABSOLUTE_PATH(PG(doc_root), length)) {
- 		filename = emalloc(length + strlen(path_info) + 2);
- 		if (filename) {
- 			memcpy(filename, PG(doc_root), length);
diff --git a/debian/patches/upstream/mssql_per_query_timeout.patch b/debian/patches/upstream/mssql_per_query_timeout.patch
deleted file mode 100644
index 0a86e48..0000000
--- a/debian/patches/upstream/mssql_per_query_timeout.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Allow the timeout on mssql to be effective per query
-Origin: http://svn.php.net/viewvc?view=revision&revision=298255
-Last-Update: 2010-05-02
-
-Index: php/ext/mssql/php_mssql.c
-===================================================================
---- php.orig/ext/mssql/php_mssql.c
-+++ php/ext/mssql/php_mssql.c
-@@ -1343,6 +1343,7 @@ PHP_FUNCTION(mssql_query)
- 	mssql_result *result;
- 	int id = -1;
- 
-+	dbsettime(MS_SQL_G(timeout));
- 	batchsize = MS_SQL_G(batchsize);
- 
- 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|rl", &query, &query_len, &mssql_link_index, &zbatchsize) == FAILURE) {
diff --git a/debian/patches/upstream/multiple_typos.patch b/debian/patches/upstream/multiple_typos.patch
deleted file mode 100644
index d1a21aa..0000000
--- a/debian/patches/upstream/multiple_typos.patch
+++ /dev/null
@@ -1,78 +0,0 @@
-Description: Fix multiple typos
-Origin: http://svn.php.net/viewvc?view=revision&revision=298840,
- http://svn.php.net/viewvc?view=revision&revision=298841,
- http://svn.php.net/viewvc?view=revision&revision=298842
-Last-Update: 2010-05-01
-
-Index: php/Zend/zend_builtin_functions.c
-===================================================================
---- php.orig/Zend/zend_builtin_functions.c
-+++ php/Zend/zend_builtin_functions.c
-@@ -179,7 +179,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_class_ali
- ZEND_END_ARG_INFO()
- 
- ZEND_BEGIN_ARG_INFO_EX(arginfo_trigger_error, 0, 0, 1)
--	ZEND_ARG_INFO(0, messsage)
-+	ZEND_ARG_INFO(0, message)
- 	ZEND_ARG_INFO(0, error_type)
- ZEND_END_ARG_INFO()
- 
-@@ -1386,7 +1386,7 @@ ZEND_FUNCTION(get_included_files)
- /* }}} */
- 
- 
--/* {{{ proto void trigger_error(string messsage [, int error_type])
-+/* {{{ proto void trigger_error(string message [, int error_type])
-    Generates a user-level error/warning/notice message */
- ZEND_FUNCTION(trigger_error)
- {
-Index: php/ext/pgsql/pgsql.c
-===================================================================
---- php.orig/ext/pgsql/pgsql.c
-+++ php/ext/pgsql/pgsql.c
-@@ -434,12 +434,12 @@ ZEND_END_ARG_INFO()
- #endif
- 
- ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_connection_status, 0, 0, 1)
--	ZEND_ARG_INFO(0, connnection)
-+	ZEND_ARG_INFO(0, connection)
- ZEND_END_ARG_INFO()
- 
- #if HAVE_PGTRANSACTIONSTATUS
- ZEND_BEGIN_ARG_INFO_EX(arginfo_pg_transaction_status, 0, 0, 1)
--	ZEND_ARG_INFO(0, connnection)
-+	ZEND_ARG_INFO(0, connection)
- ZEND_END_ARG_INFO()
- #endif
- 
-@@ -4279,7 +4279,7 @@ PHP_FUNCTION(pg_result_error_field)
- /* }}} */
- #endif
- 
--/* {{{ proto int pg_connection_status(resource connnection)
-+/* {{{ proto int pg_connection_status(resource connection)
-    Get connection status */
- PHP_FUNCTION(pg_connection_status)
- {
-@@ -4300,7 +4300,7 @@ PHP_FUNCTION(pg_connection_status)
- /* }}} */
- 
- #if HAVE_PGTRANSACTIONSTATUS
--/* {{{ proto int pg_transaction_status(resource connnection)
-+/* {{{ proto int pg_transaction_status(resource connection)
-    Get transaction status */
- PHP_FUNCTION(pg_transaction_status)
- {
-Index: php/ext/dom/node.c
-===================================================================
---- php.orig/ext/dom/node.c
-+++ php/ext/dom/node.c
-@@ -1871,7 +1871,7 @@ static void dom_canonicalization(INTERNA
- 			inclusive_ns_prefixes[nscount] = NULL;
- 		} else {
- 			php_error_docref(NULL TSRMLS_CC, E_NOTICE, 
--				"Inclusive namespace prefixes only allowed in exlcusive mode.");
-+				"Inclusive namespace prefixes only allowed in exclusive mode.");
- 		}
- 	}
- 
diff --git a/debian/patches/upstream/mysqli_options_mem_issue.patch b/debian/patches/upstream/mysqli_options_mem_issue.patch
deleted file mode 100644
index 50755b4..0000000
--- a/debian/patches/upstream/mysqli_options_mem_issue.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-Description: Fix a memory leak and corruption in mysqli_options
-Origin: http://svn.php.net/viewvc?view=revision&revision=298253
-Last-Update: 2010-05-01
-
-Index: php/ext/mysqli/mysqli_api.c
-===================================================================
---- php.orig/ext/mysqli/mysqli_api.c
-+++ php/ext/mysqli/mysqli_api.c
-@@ -1665,13 +1665,13 @@ PHP_FUNCTION(mysqli_options)
- {
- 	MY_MYSQL		*mysql;
- 	zval			*mysql_link = NULL;
--	zval			*mysql_value;
-+	zval			**mysql_value;
- 	long			mysql_option;
- 	unsigned int	l_value;
- 	long			ret;
- 	int				expected_type;
- 
--	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
-+	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "OlZ", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
- 		return;
- 	}
- 	MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_INITIALIZED);
-@@ -1682,13 +1682,13 @@ PHP_FUNCTION(mysqli_options)
- 		}
- 	}
- 	expected_type = mysqli_options_get_option_zval_type(mysql_option);
--	if (expected_type != Z_TYPE_P(mysql_value)) {
-+	if (expected_type != Z_TYPE_PP(mysql_value)) {
- 		switch (expected_type) {
- 			case IS_STRING:
--				convert_to_string_ex(&mysql_value);
-+				convert_to_string_ex(mysql_value);
- 				break;
- 			case IS_LONG:
--				convert_to_long_ex(&mysql_value);
-+				convert_to_long_ex(mysql_value);
- 				break;
- 			default:
- 				break;
-@@ -1696,10 +1696,10 @@ PHP_FUNCTION(mysqli_options)
- 	}
- 	switch (expected_type) {
- 		case IS_STRING:
--			ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_PP(&mysql_value));
-+			ret = mysql_options(mysql->mysql, mysql_option, Z_STRVAL_PP(mysql_value));
- 			break;
- 		case IS_LONG:
--			l_value = Z_LVAL_PP(&mysql_value);
-+			l_value = Z_LVAL_PP(mysql_value);
- 			ret = mysql_options(mysql->mysql, mysql_option, (char *)&l_value);
- 			break;
- 		default:
diff --git a/debian/patches/upstream/mysqli_ssl.patch b/debian/patches/upstream/mysqli_ssl.patch
deleted file mode 100644
index 7bdcd35..0000000
--- a/debian/patches/upstream/mysqli_ssl.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Description: Fix mysqli_ssl_set
-Origin: http://svn.php.net/viewvc?view=revision&revision=297688
-Last-Update: 2010-05-01
-
-Index: php/ext/mysqli/mysqli_api.c
-===================================================================
---- php.orig/ext/mysqli/mysqli_api.c
-+++ php/ext/mysqli/mysqli_api.c
-@@ -2134,7 +2134,7 @@ PHP_FUNCTION(mysqli_ssl_set)
- 	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4])   == FAILURE) {
- 		return;
- 	}
--	MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
-+	MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_INITIALIZED);
- 
- 	for (i = 0; i < 5; i++) {
- 		if (!ssl_parm_len[i]) {
diff --git a/debian/patches/upstream/pdo_reset_error_beginTransaction.patch b/debian/patches/upstream/pdo_reset_error_beginTransaction.patch
deleted file mode 100644
index db493d1..0000000
--- a/debian/patches/upstream/pdo_reset_error_beginTransaction.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Reset error state on PDO's beginTransaction()
-Origin: http://svn.php.net/viewvc?view=revision&revision=297273
-Last-Update: 2010-05-01
-
-Index: php/ext/pdo/pdo_dbh.c
-===================================================================
---- php.orig/ext/pdo/pdo_dbh.c
-+++ php/ext/pdo/pdo_dbh.c
-@@ -851,6 +851,7 @@ static PHP_METHOD(PDO, setAttribute)
- 		RETURN_FALSE;
- 	}
- 
-+	PDO_DBH_CLEAR_ERR();
- 	PDO_CONSTRUCT_CHECK;
- 
- 	if (pdo_dbh_attribute_set(dbh, attr, value TSRMLS_CC) != FAILURE) {
diff --git a/debian/patches/upstream/soap_mem_leak.patch b/debian/patches/upstream/soap_mem_leak.patch
deleted file mode 100644
index 3964ce8..0000000
--- a/debian/patches/upstream/soap_mem_leak.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-Description: Fix memory leak in the soap extension
-Origin: http://svn.php.net/viewvc?view=revision&revision=298433
-Last-Update: 2010-05-02
-
-Index: php/ext/soap/soap.c
-===================================================================
---- php.orig/ext/soap/soap.c
-+++ php/ext/soap/soap.c
-@@ -1699,6 +1699,7 @@ PHP_METHOD(SoapServer, handle)
- 				doc_request = soap_xmlParseMemory(post_data, post_data_length);
- 			}
- 		} else {
-+			zval_ptr_dtor(&retval);
- 			return;
- 		}
- 	} else {
diff --git a/debian/patches/use_system_crypt_fixes.patch b/debian/patches/use_system_crypt_fixes.patch
index 5f3d095..6724f87 100644
--- a/debian/patches/use_system_crypt_fixes.patch
+++ b/debian/patches/use_system_crypt_fixes.patch
@@ -3,14 +3,14 @@
 @@ -3,7 +3,7 @@ Bug #51059 crypt() segfaults on certain 
  --FILE--
  <?php
- $res = crypt('a', '_');
--if ($res == '*0' || $res == '*1') echo 'OK';
-+if ($res == '__DAZ.Z4ErJDo') echo 'OK';
+ $res = crypt(b'a', b'_');
+-if ($res === b'*0' || $res === b'*1') echo 'OK';
++if ($res === b'__DAZ.Z4ErJDo') echo 'OK';
  else echo 'Not OK';
  
  ?>
---- a/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt
-+++ b/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt
+--- a/ext/standard/tests/strings/crypt_blowfish_variation1.phpt
++++ b/ext/standard/tests/strings/crypt_blowfish_variation1.phpt
 @@ -3,8 +3,8 @@ Test Blowfish crypt() with invalid round
  --FILE--
  <?php
diff --git a/debian/patches/zend_int_overflow.patch b/debian/patches/zend_int_overflow.patch
index 3df7fa0..591f224 100644
--- a/debian/patches/zend_int_overflow.patch
+++ b/debian/patches/zend_int_overflow.patch
@@ -54,7 +54,7 @@ Bug-Debian: http://bugs.debian.org/570144
  --TEST--
  Bug #45877 (Array key '2147483647' left as string)
 ---INI--
--precision=20
+-precision=16
  --FILE--
  <?php
 -$keys = array(PHP_INT_MAX,
@@ -87,7 +87,7 @@ Bug-Debian: http://bugs.debian.org/570144
 -  int(1)
 -  [-%d8]=>
 -  int(1)
--  ["%d8"]=>
+-  ["%s"]=>
 -  int(1)
 +function test_value($val, $msg) {
 +	$a = array($val => 1);
diff --git a/debian/php5-fpm.init b/debian/php5-fpm.init
new file mode 100644
index 0000000..945bd09
--- /dev/null
+++ b/debian/php5-fpm.init
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          php-fpm php5-fpm
+# Required-Start:    $remote_fs $network
+# Required-Stop:     $remote_fs $network
+# Default-Start:     2 3 4 5
+# Default-Stop:
+# Short-Description: starts php-fpm
+### END INIT INFO
+
+set -u
+
+DAEMON="PHP5 FPM"
+FPM_CMD=/usr/sbin/php5-fpm
+FPM_CONF=/etc/php5/fpm/main.conf
+FPM_PID=/var/run/php5-fpm.pid
+TIMEOUT=30
+
+FPM_OPTIONS="--fpm-config $FPM_CONF"
+SSD_OPTIONS="--oknodo --quiet --pidfile $FPM_PID --exec $FPM_CMD"
+
+. /lib/lsb/init-functions
+
+case "$1" in
+    start)
+	log_begin_msg "Starting $DAEMON..."
+
+	/sbin/start-stop-daemon --start $SSD_OPTIONS -- $FPM_OPTIONS
+	log_end_msg $?
+    ;;
+    stop)
+	log_begin_msg "Stopping $DAEMON..."
+
+	/sbin/start-stop-daemon --stop $SSD_OPTIONS
+	log_end_msg $?
+    ;;
+    graceful-stop)
+	log_begin_msg "Gracefully stopping $DAEMON..."
+
+	/sbin/start-stop-daemon --stop --retry QUIT/$TIMEOUT/TERM $SSD_OPTIONS
+	log_end_msg $?
+    ;;
+    restart)
+	$0 stop
+	$0 start
+    ;;
+    reload|force-reload)
+	log_begin_msg "Reloading $DAEMON..."
+
+	/sbin/start-stop-daemon --stop --signal USR2 $SSD_OPTIONS
+	log_end_msg $?
+    ;;
+    *)
+	echo "Usage: $0 {start|stop|graceful-stop|restart|reload|force-reload}"
+	exit 1
+    ;;
+esac
diff --git a/debian/php5-fpm.postinst b/debian/php5-fpm.postinst
new file mode 100644
index 0000000..19246bf
--- /dev/null
+++ b/debian/php5-fpm.postinst
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+if [ "$1" != "configure" ]; then
+    exit 0
+fi
+
+phpini="/etc/php5/fpm/php.ini"
+
+ucf /usr/share/php5/php.ini-production $phpini
+
+exit 0
diff --git a/debian/rules b/debian/rules
index e0f33ba..9813615 100755
--- a/debian/rules
+++ b/debian/rules
@@ -95,6 +95,7 @@ export DEB_BUILD_HARDENING DEB_BUILD_HARDENING_PIE
 COMMON_CONFIG=--build=$(DEB_BUILD_GNU_TYPE) \
 		--host=$(DEB_HOST_GNU_TYPE) \
 		--sysconfdir=/etc \
+		--localstatedir=/var \
 		--mandir=/usr/share/man \
 		--disable-debug \
 		--with-regex=php \
@@ -189,7 +190,7 @@ else
 	echo 'nocheck found in DEB_BUILD_OPTIONS' | tee test-results.txt
 endif
 
-build: build-apache2-stamp build-apache2filter-stamp build-cgi-stamp build-cli-stamp build-pear-stamp test-results.txt
+build: build-apache2-stamp build-apache2filter-stamp build-cgi-stamp build-cli-stamp build-fpm-stamp build-pear-stamp test-results.txt
 
 build-apache2-stamp: configure-apache2-stamp
 	dh_testdir
@@ -209,6 +210,12 @@ build-cli-stamp: configure-cli-stamp
 
 	touch build-cli-stamp
 
+build-fpm-stamp: configure-fpm-stamp
+	dh_testdir
+	cd fpm-build && $(MAKE)
+
+	touch build-fpm-stamp
+
 
 build-cgi-stamp: configure-cgi-stamp
 	dh_testdir
@@ -241,7 +248,7 @@ build-pear-stamp: build-cgi-stamp
 	sed -i -re "s#('PEAR_CONFIG_SYSCONFDIR', PHP_SYSCONFDIR)#\1 . '/pear'#" $(CURDIR)/pear-build/usr/share/php/PEAR/Config.php
 	touch build-pear-stamp
 
-configure: configure-apache2-stamp configure-apache2filter-stamp configure-cli-stamp configure-cgi-stamp
+configure: configure-apache2-stamp configure-apache2filter-stamp configure-cli-stamp configure-fpm-stamp configure-cgi-stamp
 
 configure-apache2-stamp: prepared-stamp
 	dh_testdir
@@ -362,6 +369,29 @@ configure-cli-stamp: prepared-stamp
 	   Zend/
 	touch configure-cli-stamp
 
+configure-fpm-stamp: prepared-stamp
+	dh_testdir
+	if [ -d fpm-build ]; then rm -rf fpm-build; fi
+	-mkdir fpm-build
+	cd fpm-build && \
+        CFLAGS="$(CFLAGS)" PROG_SENDMAIL="$(PROG_SENDMAIL)" ../configure \
+		--prefix=/usr --enable-fpm --disable-cgi \
+		--with-fpm-user=www-data --with-fpm-group=www-data \
+		--with-config-file-path=/etc/php5/fpm \
+		--with-config-file-scan-dir=/etc/php5/fpm/conf.d \
+		$(COMMON_CONFIG) \
+		--with-libevent-dir=/usr \
+		--without-mm \
+		--disable-pdo \
+		--without-mysql --without-sybase-ct --without-sqlite \
+		--without-mssql --without-sqlite3
+	cd fpm-build && \
+	cp ../Zend/zend_ini_scanner.c ../Zend/zend_language_scanner.c \
+	   ../Zend/zend_ini_parser.h ../Zend/zend_language_parser.h \
+	   ../Zend/zend_ini_parser.c ../Zend/zend_language_parser.c \
+	   Zend/
+	touch configure-fpm-stamp
+
 clean: unprepared unpatch
 	dh_testdir
 	dh_testroot
@@ -371,12 +401,14 @@ clean: unprepared unpatch
 	rm -f configure-apache2filter-stamp build-apache2filter-stamp
 	rm -f configure-cgi-stamp build-cgi-stamp
 	rm -f configure-cli-stamp build-cli-stamp
+	rm -f configure-fpm-stamp build-fpm-stamp
 	rm -f build-pear-stamp
 	rm -f install-stamp
 	rm -rf apache2-build
 	rm -rf apache2filter-build
 	rm -rf cgi-build
 	rm -rf cli-build
+	rm -rf fpm-build
 	rm -rf pear-build pear-build-download
 	rm -f debian/copyright
 	rm -rf test-results.txt $(MYSQL_DATA_DIR)
@@ -386,7 +418,7 @@ clean: unprepared unpatch
 	cat debian/modulelist | while read package extname dsoname; do \
 		rm -f debian/php5-$$package.postinst; \
 	done
-	for sapi in libapache2-mod-php5 libapache2-mod-php5filter php5-cgi php5-cli; do \
+	for sapi in libapache2-mod-php5 libapache2-mod-php5filter php5-cgi php5-cli php5-fpm; do \
 		for cruft in postrm links; do \
 			rm -f debian/$${sapi}.$${cruft}; \
 		done; \
@@ -465,7 +497,7 @@ install: build
 
 	# install extensions
 	ext=`./debian/libapache2-mod-php5/usr/bin/php-config --extension-dir`;\
-	for i in libapache2-mod-php5 libapache2-mod-php5filter php5-cgi php5-cli; do \
+	for i in libapache2-mod-php5 libapache2-mod-php5filter php5-cgi php5-fpm php5-cli; do \
 		mkdir -p debian/$$i/$${ext}; \
 	done; \
 	cat debian/modulelist debian/extramodulelist | while read package extname dsoname; do \
@@ -488,6 +520,17 @@ install: build
 	cp cli-build/sapi/cli/php debian/php5-cli/usr/bin/php5
 	cp cli-build/sapi/cli/php.1 debian/php5-cli/usr/share/man/man1/php5.1
 
+	# install FPM
+	mkdir -p debian/php5-fpm/usr/sbin debian/php5-fpm/usr/share/man/man8/ debian/php5-fpm/etc/php5/fpm/pool.d
+	cp fpm-build/sapi/fpm/php-fpm debian/php5-fpm/usr/sbin/php5-fpm
+	cp fpm-build/sapi/fpm/php-fpm.1 debian/php5-fpm/usr/share/man/man8/php5-fpm.8
+	# we don't want the pool definitions on the main file itself:
+	sed -r '/('"'"'|\[)www('"'"'|\])/Q' < fpm-build/sapi/fpm/php-fpm.conf > \
+	    debian/php5-fpm/etc/php5/fpm/main.conf
+	# extract the first pool, called "www," from the config file:
+	sed -nr '/('"'"'|\[)www('"'"'|\])/{h;p;d};x;/www/{x;p}' < fpm-build/sapi/fpm/php-fpm.conf \
+	    > debian/php5-fpm/etc/php5/fpm/pool.d/www.conf
+
 	# move and install -dev files
 	dh_movefiles --sourcedir=debian/libapache2-mod-php5
 	rm -rf debian/libapache2-mod-php5/usr/lib/php5/build/ \
@@ -524,7 +567,7 @@ install: build
 
 	# install some generic lintian overrides
 	ext=`debian/php5-dev/usr/bin/php-config5 --extension-dir | cut -b2- `; \
-	for sapi in php5-cli php5-cgi libapache2-mod-php5 libapache2-mod-php5filter; do \
+	for sapi in php5-cli php5-fpm php5-cgi libapache2-mod-php5 libapache2-mod-php5filter; do \
 		mkdir -p $(CURDIR)/debian/"$$sapi"/usr/share/lintian/overrides/; \
 		sed "s/@sapi@/$$sapi/g;s, at extdir@,$$ext,g" \
 		    < $(CURDIR)/debian/php5-sapi.lintian-overrides \
@@ -593,7 +636,7 @@ binary-arch: build install
 
 	# likewise, for the different sapi implementations
 	for tmpl in postrm links; do \
-		for sapi in apache2 apache2filter cgi cli; do \
+		for sapi in apache2 apache2filter cgi cli fpm; do \
 			sed -e "s/@sapi@/$$sapi/g" \
 		  	< debian/php5-sapi.$$tmpl \
 		  	> debian/php5-$${sapi}.$$tmpl; \
@@ -610,12 +653,13 @@ binary-arch: build install
 		ln -s php5-common debian/php5-$$package/usr/share/doc/php5-$$package; \
 	done
 
-	for package in php5-dbg php5-dev php5-cgi php5-cli libapache2-mod-php5 libapache2-mod-php5filter; do \
+	for package in php5-dbg php5-dev php5-cgi php5-cli php5-fpm libapache2-mod-php5 libapache2-mod-php5filter; do \
 		rm -rf debian/$$package/usr/share/doc/$$package; \
 		ln -s php5-common debian/$$package/usr/share/doc/$$package; \
 	done
 	dh_installcron -pphp5-common --name=php5
 	dh_installchangelogs -pphp5-common NEWS
+	dh_installinit
 	dh_strip -s --dbg-package=php5-dbg
 	dh_link -s
 	dh_compress -s -Xphp.ini
@@ -624,14 +668,14 @@ binary-arch: build install
 	dh_shlibdeps -s
 
 	phpapi=`./debian/php5-dev/usr/bin/php-config5 --phpapi`; \
-	for i in libapache2-mod-php5 libapache2-mod-php5filter php5-cgi php5-cli; do \
+	for i in libapache2-mod-php5 libapache2-mod-php5filter php5-cgi php5-cli php5-fpm; do \
 		echo "php:Provides=phpapi-$${phpapi}" >> debian/$$i.substvars; \
 	done; \
 	cat debian/modulelist | while read package extname dsoname; do \
 		echo "php:Depends=phpapi-$${phpapi}" >> debian/php5-$$package.substvars; \
 	done
 
-	for i in cgi cli; do \
+	for i in cgi cli fpm; do \
 		"$$i"-build/sapi/cli/php -n -r '$(BUILTIN_EXTENSION_CHECK)' \
 			>> debian/php5-"$$i".substvars; \
 	done
diff --git a/debian/setup-mysql.sh b/debian/setup-mysql.sh
old mode 100755
new mode 100644
-- 
1.7.1





More information about the Pkg-php-commits mailing list