18938882 PHP 5.2 and 5.3 need some changes to build with zlib 1.2.8
authorPetr Sumbera <petr.sumbera@oracle.com>
Thu, 03 Jul 2014 14:21:36 -0700
changeset 1984 00f4f2142725
parent 1983 3ecae322d7a8
child 1985 1adf84d20bb8
18938882 PHP 5.2 and 5.3 need some changes to build with zlib 1.2.8
components/php-5_2/php-sapi/patches/05_php_6818228.patch
components/php-5_2/php-sapi/patches/41_php_zlib.patch
components/php-5_2/php-sapi/php.mk
components/php-5_3/php-sapi/patches/051_php_6818228.patch
components/php-5_3/php-sapi/patches/052_php_6818228.patch
components/php-5_3/php-sapi/patches/172_php_zlib.patch
components/php-5_3/php-sapi/php.mk
--- a/components/php-5_2/php-sapi/patches/05_php_6818228.patch	Thu Jul 03 08:08:13 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
---- php-5.2.11/ext/zlib/my_zlib.h	Thu Jan 25 04:13:36 2007
-+++ php-5.2.11/ext/zlib/my_zlib.h	Tue Oct 20 13:55:01 2009
[email protected]@ -1180,8 +1180,8 @@
-    degrade compression.
- */
- 
--ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
--                                      z_off_t offset, int whence));
-+ZEXTERN int ZEXPORT      gzseek OF((gzFile file,
-+                                      int offset, int whence));
- /*
-       Sets the starting position for the next gzread or gzwrite on the
-    given compressed file. The offset represents a number of bytes in the
[email protected]@ -1205,7 +1205,7 @@
-    gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
- */
- 
--ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
-+ZEXTERN int ZEXPORT    gztell OF((gzFile file));
- /*
-      Returns the starting position for the next gzread or gzwrite on the
-    given compressed file. This position represents a number of bytes in the
[email protected]@ -1274,7 +1274,7 @@
- */
- 
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
--                                          z_off_t len2));
-+                                          int len2));
- /*
-      Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
-    and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
[email protected]@ -1298,7 +1298,7 @@
-      if (crc != original_crc) error();
- */
- 
--ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, int len2));
- 
- /*
-      Combine two CRC-32 check values into one.  For two sequences of bytes,
---- php-5.2.11/ext/zlib/php_zlib.h.ORIG	Tue Oct 20 13:56:27 2009
-+++ php-5.2.11/ext/zlib/php_zlib.h	Tue Oct 20 13:56:38 2009
[email protected]@ -22,7 +22,7 @@
- #ifndef PHP_ZLIB_H
- #define PHP_ZLIB_H
- 
--#include <zlib.h>
-+#include "my_zlib.h"
- 
- ZEND_BEGIN_MODULE_GLOBALS(zlib)
- 	/* variables for transparent gzip encoding */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/php-5_2/php-sapi/patches/41_php_zlib.patch	Thu Jul 03 14:21:36 2014 -0700
@@ -0,0 +1,55 @@
+Patch origin: upstream
+Patch status: Part 1: unclear; patch attached to bug
+Patch status: Part 2: more generic fix already in php 5.3
+
+https://bugs.php.net/bug.php?id=53829
+http://git.php.net/?p=php-src.git;a=commitdiff;h=a8948d08083bf59d437ac21abe5929f5668f41d7
+
+--- php-5.2.17/ext/zlib/zlib.c
++++ php-5.2.17/ext/zlib/zlib.c
[email protected]@ -58,6 +58,18 @@
+ # endif
+ #endif
+ 
++/*
++ * zlib include files can define the following preprocessor defines which rename
++ * the corresponding PHP functions to gzopen64, gzseek64 and gztell64 and thereby
++ * breaking some software, most notably PEAR's Archive_Tar, which halts execution
++ * without error message on gzip compressed archivesa.
++ *
++ * This only seems to happen on 32bit systems with large file support.
++ */
++#undef gzopen
++#undef gzseek
++#undef gztell
++
+ #if defined(HAVE_UNISTD_H) && defined(PHP_WIN32)
+ # undef HAVE_UNISTD_H
+ #endif
+--- php-5.2.17/ext/zlib/tests/gzgetc_basic.phpt
++++ php-5.2.17/ext/zlib/tests/gzgetc_basic.phpt
[email protected]@ -14,16 +14,17 @@
+ 
+ $f = dirname(__FILE__)."/004.txt.gz";
+ $h = gzopen($f, 'r');
++if ($h) {
++	$count = 0;
++	while (($c = fgetc( $h )) !== false) {
++	   $count++;
++	   echo $c;
++	}
+ 
+-$count = 0;
+-while (gzeof($h) === false) {
+-   $count++;
+-   echo fgetc( $h );
++	echo "\ncharacters counted=$count\n";
++	gzclose($h);
+ }
+ 
+-echo "\ncharacters counted=$count\n";
+-gzclose($h);
+-
+ ?>
+ ===DONE===
+ --EXPECT--
--- a/components/php-5_2/php-sapi/php.mk	Thu Jul 03 08:08:13 2014 -0700
+++ b/components/php-5_2/php-sapi/php.mk	Thu Jul 03 14:21:36 2014 -0700
@@ -18,15 +18,14 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 #
 
 COMPONENT_PRE_INSTALL_ACTION += ( \
 	$(MKDIR) $(INSTALL_ROOT)/$(PHP_PEAR_CACHE_DIR) )
 
 COMPONENT_POST_UNPACK_ACTION += ( \
-	echo $(PATH); \
-	cp /usr/include/zlib.h $(COMPONENT_SRC)/ext/zlib/my_zlib.h )
+	echo $(PATH); )
 
 COMPONENT_PRE_CONFIGURE_ACTION = ( \
 	cd $(COMPONENT_SRC); $(ENV) -i PATH=/usr/gnu/bin:$(PATH) \
--- a/components/php-5_3/php-sapi/patches/051_php_6818228.patch	Thu Jul 03 08:08:13 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
---- php-5.3.10/ext/zlib/my_zlib.h_orig	Wed Feb  8 11:25:25 2012
-+++ php-5.3.10/ext/zlib/my_zlib.h	Wed Feb  8 11:25:26 2012
[email protected]@ -1180,8 +1180,8 @@
-    degrade compression.
- */
- 
--ZEXTERN z_off_t ZEXPORT    gzseek OF((gzFile file,
--                                      z_off_t offset, int whence));
-+ZEXTERN int ZEXPORT    gzseek OF((gzFile file,
-+                                      int offset, int whence));
- /*
-       Sets the starting position for the next gzread or gzwrite on the
-    given compressed file. The offset represents a number of bytes in the
[email protected]@ -1205,7 +1205,7 @@
-    gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
- */
- 
--ZEXTERN z_off_t ZEXPORT    gztell OF((gzFile file));
-+ZEXTERN int ZEXPORT    gztell OF((gzFile file));
- /*
-      Returns the starting position for the next gzread or gzwrite on the
-    given compressed file. This position represents a number of bytes in the
[email protected]@ -1274,7 +1274,7 @@
- */
- 
- ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2,
--                                          z_off_t len2));
-+                                          int len2));
- /*
-      Combine two Adler-32 checksums into one.  For two sequences of bytes, seq1
-    and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for
[email protected]@ -1298,7 +1298,7 @@
-      if (crc != original_crc) error();
- */
- 
--ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2));
-+ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, int len2));
- 
- /*
-      Combine two CRC-32 check values into one.  For two sequences of bytes,
--- a/components/php-5_3/php-sapi/patches/052_php_6818228.patch	Thu Jul 03 08:08:13 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
---- php-5.3.10/ext/zlib/php_zlib.h_orig	Sun Jan  1 05:15:04 2012
-+++ php-5.3.10/ext/zlib/php_zlib.h	Wed Feb  8 11:25:26 2012
[email protected]@ -22,7 +22,7 @@
- #ifndef PHP_ZLIB_H
- #define PHP_ZLIB_H
- 
--#include <zlib.h>
-+#include "my_zlib.h"
- 
- ZEND_BEGIN_MODULE_GLOBALS(zlib)
- 	/* variables for transparent gzip encoding */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/php-5_3/php-sapi/patches/172_php_zlib.patch	Thu Jul 03 14:21:36 2014 -0700
@@ -0,0 +1,26 @@
+Patch origin: upstream
+Patch status: unclear; patch attached to bug
+
+https://bugs.php.net/bug.php?id=53829
+
+--- php-5.3.17/ext/zlib/zlib.c
++++ php-5.3.17/ext/zlib/zlib.c
[email protected]@ -58,6 +58,18 @@
+ # endif
+ #endif
+ 
++/*
++ * zlib include files can define the following preprocessor defines which rename
++ * the corresponding PHP functions to gzopen64, gzseek64 and gztell64 and thereby
++ * breaking some software, most notably PEAR's Archive_Tar, which halts execution
++ * without error message on gzip compressed archivesa.
++ *
++ * This only seems to happen on 32bit systems with large file support.
++ */
++#undef gzopen
++#undef gzseek
++#undef gztell
++
+ #if defined(HAVE_UNISTD_H) && defined(PHP_WIN32)
+ # undef HAVE_UNISTD_H
+ #endif
--- a/components/php-5_3/php-sapi/php.mk	Thu Jul 03 08:08:13 2014 -0700
+++ b/components/php-5_3/php-sapi/php.mk	Thu Jul 03 14:21:36 2014 -0700
@@ -29,7 +29,6 @@
 #
 COMPONENT_POST_UNPACK_ACTION += ( \
 	echo $(PATH); \
-	$(CP) /usr/include/zlib.h $(COMPONENT_SRC)/ext/zlib/my_zlib.h; \
 	$(RM) $(COMPONENT_SRC)/Zend/zend_ini_parser.c \
 	      $(COMPONENT_SRC)/Zend/zend_ini_parser.h \
 	      $(COMPONENT_SRC)/Zend/zend_ini_parser.output \