components/php-5_2/php-sapi/patches/41_php_zlib.patch
author Petr Sumbera <petr.sumbera@oracle.com>
Thu, 03 Jul 2014 14:21:36 -0700
changeset 1984 00f4f2142725
permissions -rw-r--r--
18938882 PHP 5.2 and 5.3 need some changes to build with zlib 1.2.8

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--