18938882 PHP 5.2 and 5.3 need some changes to build with zlib 1.2.8 s11-update
authorPetr Sumbera <petr.sumbera@oracle.com>
Mon, 19 Jan 2015 12:08:42 -0800
branchs11-update
changeset 3797 b4272e89e9f2
parent 3796 82cd21906ac2
child 3801 358a41a22771
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/50_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/180_php_zlib.patch
components/php-5_3/php-sapi/php.mk
--- a/components/php-5_2/php-sapi/patches/05_php_6818228.patch	Fri Feb 06 16:50:21 2015 -0800
+++ /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
-@@ -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
-@@ -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
-@@ -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
-@@ -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
-@@ -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/50_php_zlib.patch	Mon Jan 19 12:08:42 2015 -0800
@@ -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
+@@ -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
+@@ -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	Fri Feb 06 16:50:21 2015 -0800
+++ b/components/php-5_2/php-sapi/php.mk	Mon Jan 19 12:08:42 2015 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 COMPONENT_PRE_INSTALL_ACTION += ( \
@@ -27,8 +27,7 @@
 
 COMPONENT_POST_UNPACK_ACTION += ( \
 	set -e; \
-	echo $(PATH); \
-	cp /usr/include/zlib.h $(COMPONENT_SRC)/ext/zlib/my_zlib.h )
+	echo $(PATH); )
 
 COMPONENT_PRE_CONFIGURE_ACTION = ( \
 	set -e; \
--- a/components/php-5_3/php-sapi/patches/051_php_6818228.patch	Fri Feb 06 16:50:21 2015 -0800
+++ /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
-@@ -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
-@@ -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
-@@ -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
-@@ -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	Fri Feb 06 16:50:21 2015 -0800
+++ /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
-@@ -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/180_php_zlib.patch	Mon Jan 19 12:08:42 2015 -0800
@@ -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
+@@ -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	Fri Feb 06 16:50:21 2015 -0800
+++ b/components/php-5_3/php-sapi/php.mk	Mon Jan 19 12:08:42 2015 -0800
@@ -18,7 +18,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 #
 
 COMPONENT_PRE_INSTALL_ACTION += ( \
@@ -31,7 +31,6 @@
 COMPONENT_POST_UNPACK_ACTION += ( \
 	set -e; \
 	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 \