cellog                                   Fri, 24 Jul 2009 17:07:05 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=284712

Log:
merge unmerged changes between branches, remove unnecessary test for zip 
signature failure in badparameters.phpt

Changed paths:
    U   pecl/phar/trunk/Makefile.frag
    U   pecl/phar/trunk/dirstream.c
    U   pecl/phar/trunk/dirstream.h
    U   pecl/phar/trunk/func_interceptors.c
    U   pecl/phar/trunk/func_interceptors.h
    U   pecl/phar/trunk/phar.c
    U   pecl/phar/trunk/phar_internal.h
    U   pecl/phar/trunk/phar_object.c
    U   pecl/phar/trunk/phar_path_check.c
    U   pecl/phar/trunk/phar_path_check.re
    U   pecl/phar/trunk/pharzip.h
    U   pecl/phar/trunk/php_phar.h
    U   pecl/phar/trunk/stream.c
    U   pecl/phar/trunk/stream.h
    U   pecl/phar/trunk/stub.h
    U   pecl/phar/trunk/tar.c
    U   pecl/phar/trunk/tar.h
    U   pecl/phar/trunk/tests/badparameters.phpt
    U   pecl/phar/trunk/util.c
    U   php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
    U   php/php-src/branches/PHP_5_3/ext/phar/tests/badparameters.phpt
    U   php/php-src/trunk/ext/phar/func_interceptors.c
    U   php/php-src/trunk/ext/phar/phar.c
    U   php/php-src/trunk/ext/phar/phar_object.c
    U   php/php-src/trunk/ext/phar/tar.c
    U   php/php-src/trunk/ext/phar/tests/badparameters.phpt
    U   php/php-src/trunk/ext/phar/util.c

Modified: pecl/phar/trunk/Makefile.frag
===================================================================
--- pecl/phar/trunk/Makefile.frag	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/Makefile.frag	2009-07-24 17:07:05 UTC (rev 284712)
@@ -4,7 +4,7 @@

 pharcmd: $(builddir)/phar.php $(builddir)/phar.phar

-PHP_PHARCMD_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0
+PHP_PHARCMD_SETTINGS = -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0'
 PHP_PHARCMD_EXECUTABLE = ` \
 	if test -x "$(top_builddir)/$(SAPI_CLI_PATH)"; then \
 		$(top_srcdir)/build/shtool echo -n -- "$(top_builddir)/$(SAPI_CLI_PATH) -n"; \

Modified: pecl/phar/trunk/dirstream.c
===================================================================
--- pecl/phar/trunk/dirstream.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/dirstream.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar:// stream wrapper support                                       |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/dirstream.h
===================================================================
--- pecl/phar/trunk/dirstream.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/dirstream.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2006-2008 The PHP Group                                |
+  | Copyright (c) 2006-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/func_interceptors.c
===================================================================
--- pecl/phar/trunk/func_interceptors.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/func_interceptors.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |
@@ -646,8 +646,8 @@
 			/* fopen within phar, if :// is not in the url, then prepend phar://<archive>/ */
 			entry_len = (int) filename_length;
 			if (FAILURE == phar_get_archive(&phar, arch, arch_len, NULL, 0, NULL TSRMLS_CC)) {
+				efree(arch);
 				efree(entry);
-				efree(arch);
 				goto skip_phar;
 			}
 splitted:

Modified: pecl/phar/trunk/func_interceptors.h
===================================================================
--- pecl/phar/trunk/func_interceptors.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/func_interceptors.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2006-2008 The PHP Group                                |
+  | Copyright (c) 2006-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/phar.c
===================================================================
--- pecl/phar/trunk/phar.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/phar.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -3151,7 +3151,7 @@
 				return EOF;
 #endif
 			default: {
-				char *digest;
+				char *digest = NULL;
 				int digest_len;

 				if (FAILURE == phar_create_signature(phar, newfile, &digest, &digest_len, error TSRMLS_CC)) {
@@ -3160,7 +3160,9 @@
 						spprintf(error, 0, "phar error: unable to write signature: %s", save);
 						efree(save);
 					}
-					efree(digest);
+					if (digest) {
+						efree(digest);
+					}
 					if (closeoldfile) {
 						php_stream_close(oldfile);
 					}
@@ -3685,7 +3687,7 @@
 	PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
 	PUTS("Phar fully realized by Gregory Beaver and Marcus Boerger.");
 	PUTS(!sapi_module.phpinfo_as_text?"<br />":"\n");
-	PUTS("Portions of tar implementation Copyright (c) 2003-2008 Tim Kientzle.");
+	PUTS("Portions of tar implementation Copyright (c) 2003-2009 Tim Kientzle.");
 	php_info_print_box_end();

 	DISPLAY_INI_ENTRIES();

Modified: pecl/phar/trunk/phar_internal.h
===================================================================
--- pecl/phar/trunk/phar_internal.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/phar_internal.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2006-2008 The PHP Group                                |
+  | Copyright (c) 2006-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/phar_object.c
===================================================================
--- pecl/phar/trunk/phar_object.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/phar_object.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/phar_path_check.c
===================================================================
--- pecl/phar/trunk/phar_path_check.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/phar_path_check.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -4,7 +4,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2007-2008 The PHP Group                                |
+  | Copyright (c) 2007-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/phar_path_check.re
===================================================================
--- pecl/phar/trunk/phar_path_check.re	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/phar_path_check.re	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2007-2008 The PHP Group                                |
+  | Copyright (c) 2007-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/pharzip.h
===================================================================
--- pecl/phar/trunk/pharzip.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/pharzip.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2006-2008 The PHP Group                                |
+  | Copyright (c) 2006-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/php_phar.h
===================================================================
--- pecl/phar/trunk/php_phar.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/php_phar.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/stream.c
===================================================================
--- pecl/phar/trunk/stream.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/stream.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar:// stream wrapper support                                       |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/stream.h
===================================================================
--- pecl/phar/trunk/stream.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/stream.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension                        |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2006-2008 The PHP Group                                |
+  | Copyright (c) 2006-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/stub.h
===================================================================
--- pecl/phar/trunk/stub.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/stub.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -2,7 +2,7 @@
   +----------------------------------------------------------------------+
   | phar php single-file executable PHP extension generated stub         |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/tar.c
===================================================================
--- pecl/phar/trunk/tar.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/tar.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -284,7 +284,7 @@
 # define PHAR_GET_32(buffer) (php_uint32) *(buffer)
 #endif
 			myphar->sig_flags = PHAR_GET_32(buf);
-			if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error TSRMLS_CC)) {
+			if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf + 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error TSRMLS_CC)) {
 				if (error) {
 					char *save = *error;
 					spprintf(error, 4096, "phar error: tar-based phar \"%s\" signature cannot be verified: %s", fname, save);

Modified: pecl/phar/trunk/tar.h
===================================================================
--- pecl/phar/trunk/tar.h	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/tar.h	2009-07-24 17:07:05 UTC (rev 284712)
@@ -4,7 +4,7 @@
   +----------------------------------------------------------------------+
   | TAR archive support for Phar                                         |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: pecl/phar/trunk/tests/badparameters.phpt
===================================================================
--- pecl/phar/trunk/tests/badparameters.phpt	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/tests/badparameters.phpt	2009-07-24 17:07:05 UTC (rev 284712)
@@ -76,11 +76,6 @@
 } catch (Exception $e) {
 echo $e->getMessage() . "\n";
 }
-try {
-$c->setSignatureAlgorithm(Phar::MD5);
-} catch (Exception $e) {
-echo $e->getMessage() . "\n";
-}
 $a->compress(array());
 try {
 $a->compress(1);
@@ -160,7 +155,6 @@
 Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
 Cannot change stub: phar.readonly=1
 Cannot set signature algorithm, phar is read-only
-Cannot set signature algorithm, not possible with zip-based phar archives

 Warning: Phar::compress() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
 Cannot compress phar archive, phar is read-only

Modified: pecl/phar/trunk/util.c
===================================================================
--- pecl/phar/trunk/util.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ pecl/phar/trunk/util.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -3,7 +3,7 @@
   | phar php single-file executable PHP extension                        |
   | utility functions                                                    |
   +----------------------------------------------------------------------+
-  | Copyright (c) 2005-2008 The PHP Group                                |
+  | Copyright (c) 2005-2009 The PHP Group                                |
   +----------------------------------------------------------------------+
   | This source file is subject to version 3.01 of the PHP license,      |
   | that is bundled with this package in the file LICENSE, and is        |

Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -30,6 +30,12 @@
 static zend_class_entry *phar_ce_entry;
 #endif

+#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3)
+# define PHAR_ARG_INFO
+#else
+# define PHAR_ARG_INFO static
+#endif
+
 static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_DC) /* {{{ */
 {
 	char *ext;
@@ -4980,7 +4986,7 @@
 #endif /* HAVE_SPL */

 /* {{{ phar methods */
-
+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar___construct, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 	ZEND_ARG_INFO(0, flags)
@@ -4988,30 +4994,36 @@
 	ZEND_ARG_INFO(0, fileformat)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_createDS, 0, 0, 0)
 	ZEND_ARG_INFO(0, index)
 	ZEND_ARG_INFO(0, webindex)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_loadPhar, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 	ZEND_ARG_INFO(0, alias)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mapPhar, 0, 0, 0)
 	ZEND_ARG_INFO(0, alias)
 	ZEND_ARG_INFO(0, offset)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mount, 0, 0, 2)
 	ZEND_ARG_INFO(0, inphar)
 	ZEND_ARG_INFO(0, externalfile)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mungServer, 0, 0, 1)
 	ZEND_ARG_INFO(0, munglist)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_webPhar, 0, 0, 0)
 	ZEND_ARG_INFO(0, alias)
 	ZEND_ARG_INFO(0, index)
@@ -5020,105 +5032,126 @@
 	ZEND_ARG_INFO(0, rewrites)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_running, 0, 0, 1)
 	ZEND_ARG_INFO(0, retphar)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_ua, 0, 0, 1)
 	ZEND_ARG_INFO(0, archive)
 ZEND_END_ARG_INFO()

 #if HAVE_SPL
-
+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_build, 0, 0, 1)
 	ZEND_ARG_INFO(0, iterator)
 	ZEND_ARG_INFO(0, base_directory)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_conv, 0, 0, 0)
 	ZEND_ARG_INFO(0, format)
 	ZEND_ARG_INFO(0, compression_type)
 	ZEND_ARG_INFO(0, file_ext)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comps, 0, 0, 1)
 	ZEND_ARG_INFO(0, compression_type)
 	ZEND_ARG_INFO(0, file_ext)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_decomp, 0, 0, 0)
 	ZEND_ARG_INFO(0, file_ext)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comp, 0, 0, 1)
 	ZEND_ARG_INFO(0, compression_type)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_compo, 0, 0, 0)
 	ZEND_ARG_INFO(0, compression_type)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_copy, 0, 0, 2)
 	ZEND_ARG_INFO(0, newfile)
 	ZEND_ARG_INFO(0, oldfile)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_delete, 0, 0, 1)
 	ZEND_ARG_INFO(0, entry)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromdir, 0, 0, 1)
 	ZEND_ARG_INFO(0, base_dir)
 	ZEND_ARG_INFO(0, regex)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetExists, 0, 0, 1)
 	ZEND_ARG_INFO(0, entry)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetSet, 0, 0, 2)
 	ZEND_ARG_INFO(0, entry)
 	ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setAlias, 0, 0, 1)
 	ZEND_ARG_INFO(0, alias)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setMetadata, 0, 0, 1)
 	ZEND_ARG_INFO(0, metadata)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setSigAlgo, 0, 0, 1)
 	ZEND_ARG_INFO(0, algorithm)
 	ZEND_ARG_INFO(0, privatekey)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setStub, 0, 0, 1)
 	ZEND_ARG_INFO(0, newstub)
 	ZEND_ARG_INFO(0, maxlen)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_emptydir, 0, 0, 0)
 	ZEND_ARG_INFO(0, dirname)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_extract, 0, 0, 1)
 	ZEND_ARG_INFO(0, pathto)
 	ZEND_ARG_INFO(0, files)
 	ZEND_ARG_INFO(0, overwrite)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_addfile, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 	ZEND_ARG_INFO(0, localname)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromstring, 0, 0, 1)
 	ZEND_ARG_INFO(0, localname)
 	ZEND_ARG_INFO(0, contents)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_isff, 0, 0, 1)
 	ZEND_ARG_INFO(0, fileformat)
 ZEND_END_ARG_INFO()
@@ -5191,10 +5224,12 @@
 };

 #if HAVE_SPL
+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_entry___construct, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_entry_chmod, 0, 0, 1)
 	ZEND_ARG_INFO(0, perms)
 ZEND_END_ARG_INFO()

Modified: php/php-src/branches/PHP_5_3/ext/phar/tests/badparameters.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/phar/tests/badparameters.phpt	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/branches/PHP_5_3/ext/phar/tests/badparameters.phpt	2009-07-24 17:07:05 UTC (rev 284712)
@@ -76,11 +76,6 @@
 } catch (Exception $e) {
 echo $e->getMessage() . "\n";
 }
-try {
-$c->setSignatureAlgorithm(Phar::MD5);
-} catch (Exception $e) {
-echo $e->getMessage() . "\n";
-}
 $a->compress(array());
 try {
 $a->compress(1);
@@ -160,7 +155,6 @@
 Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
 Cannot change stub: phar.readonly=1
 Cannot set signature algorithm, phar is read-only
-Cannot set signature algorithm, not possible with zip-based phar archives

 Warning: Phar::compress() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
 Cannot compress phar archive, phar is read-only

Modified: php/php-src/trunk/ext/phar/func_interceptors.c
===================================================================
--- php/php-src/trunk/ext/phar/func_interceptors.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/trunk/ext/phar/func_interceptors.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -71,8 +71,8 @@
 			} else {
 				spprintf(&name, 4096, "phar://%s/%s", arch, entry);
 			}
+			efree(arch);
 			efree(entry);
-			efree(arch);
 			if (zcontext) {
 				context = php_stream_context_from_zval(zcontext, 0);
 			}

Modified: php/php-src/trunk/ext/phar/phar.c
===================================================================
--- php/php-src/trunk/ext/phar/phar.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/trunk/ext/phar/phar.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -3702,6 +3702,9 @@
 	ZEND_MOD_OPTIONAL("openssl")
 	ZEND_MOD_OPTIONAL("zlib")
 	ZEND_MOD_OPTIONAL("standard")
+#if defined(HAVE_HASH) && !defined(COMPILE_DL_HASH)
+	ZEND_MOD_REQUIRED("hash")
+#endif
 #if HAVE_SPL
 	ZEND_MOD_REQUIRED("spl")
 #endif

Modified: php/php-src/trunk/ext/phar/phar_object.c
===================================================================
--- php/php-src/trunk/ext/phar/phar_object.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/trunk/ext/phar/phar_object.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -30,6 +30,12 @@
 static zend_class_entry *phar_ce_entry;
 #endif

+#if (PHP_MAJOR_VERSION == 5) && (PHP_MINOR_VERSION >= 3)
+# define PHAR_ARG_INFO
+#else
+# define PHAR_ARG_INFO static
+#endif
+
 static int phar_file_type(HashTable *mimes, char *file, char **mime_type TSRMLS_DC) /* {{{ */
 {
 	char *ext;
@@ -4980,7 +4986,7 @@
 #endif /* HAVE_SPL */

 /* {{{ phar methods */
-
+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar___construct, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 	ZEND_ARG_INFO(0, flags)
@@ -4988,30 +4994,36 @@
 	ZEND_ARG_INFO(0, fileformat)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_createDS, 0, 0, 0)
 	ZEND_ARG_INFO(0, index)
 	ZEND_ARG_INFO(0, webindex)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_loadPhar, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 	ZEND_ARG_INFO(0, alias)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mapPhar, 0, 0, 0)
 	ZEND_ARG_INFO(0, alias)
 	ZEND_ARG_INFO(0, offset)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mount, 0, 0, 2)
 	ZEND_ARG_INFO(0, inphar)
 	ZEND_ARG_INFO(0, externalfile)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_mungServer, 0, 0, 1)
 	ZEND_ARG_INFO(0, munglist)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_webPhar, 0, 0, 0)
 	ZEND_ARG_INFO(0, alias)
 	ZEND_ARG_INFO(0, index)
@@ -5020,105 +5032,126 @@
 	ZEND_ARG_INFO(0, rewrites)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_running, 0, 0, 1)
 	ZEND_ARG_INFO(0, retphar)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_ua, 0, 0, 1)
 	ZEND_ARG_INFO(0, archive)
 ZEND_END_ARG_INFO()

 #if HAVE_SPL
-
+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_build, 0, 0, 1)
 	ZEND_ARG_INFO(0, iterator)
 	ZEND_ARG_INFO(0, base_directory)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_conv, 0, 0, 0)
 	ZEND_ARG_INFO(0, format)
 	ZEND_ARG_INFO(0, compression_type)
 	ZEND_ARG_INFO(0, file_ext)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comps, 0, 0, 1)
 	ZEND_ARG_INFO(0, compression_type)
 	ZEND_ARG_INFO(0, file_ext)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_decomp, 0, 0, 0)
 	ZEND_ARG_INFO(0, file_ext)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_comp, 0, 0, 1)
 	ZEND_ARG_INFO(0, compression_type)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_compo, 0, 0, 0)
 	ZEND_ARG_INFO(0, compression_type)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_copy, 0, 0, 2)
 	ZEND_ARG_INFO(0, newfile)
 	ZEND_ARG_INFO(0, oldfile)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_delete, 0, 0, 1)
 	ZEND_ARG_INFO(0, entry)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromdir, 0, 0, 1)
 	ZEND_ARG_INFO(0, base_dir)
 	ZEND_ARG_INFO(0, regex)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetExists, 0, 0, 1)
 	ZEND_ARG_INFO(0, entry)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_offsetSet, 0, 0, 2)
 	ZEND_ARG_INFO(0, entry)
 	ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setAlias, 0, 0, 1)
 	ZEND_ARG_INFO(0, alias)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setMetadata, 0, 0, 1)
 	ZEND_ARG_INFO(0, metadata)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setSigAlgo, 0, 0, 1)
 	ZEND_ARG_INFO(0, algorithm)
 	ZEND_ARG_INFO(0, privatekey)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_setStub, 0, 0, 1)
 	ZEND_ARG_INFO(0, newstub)
 	ZEND_ARG_INFO(0, maxlen)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_emptydir, 0, 0, 0)
 	ZEND_ARG_INFO(0, dirname)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_extract, 0, 0, 1)
 	ZEND_ARG_INFO(0, pathto)
 	ZEND_ARG_INFO(0, files)
 	ZEND_ARG_INFO(0, overwrite)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_addfile, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 	ZEND_ARG_INFO(0, localname)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_fromstring, 0, 0, 1)
 	ZEND_ARG_INFO(0, localname)
 	ZEND_ARG_INFO(0, contents)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_phar_isff, 0, 0, 1)
 	ZEND_ARG_INFO(0, fileformat)
 ZEND_END_ARG_INFO()
@@ -5191,10 +5224,12 @@
 };

 #if HAVE_SPL
+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_entry___construct, 0, 0, 1)
 	ZEND_ARG_INFO(0, filename)
 ZEND_END_ARG_INFO()

+PHAR_ARG_INFO
 ZEND_BEGIN_ARG_INFO_EX(arginfo_entry_chmod, 0, 0, 1)
 	ZEND_ARG_INFO(0, perms)
 ZEND_END_ARG_INFO()

Modified: php/php-src/trunk/ext/phar/tar.c
===================================================================
--- php/php-src/trunk/ext/phar/tar.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/trunk/ext/phar/tar.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -284,7 +284,7 @@
 # define PHAR_GET_32(buffer) (php_uint32) *(buffer)
 #endif
 			myphar->sig_flags = PHAR_GET_32(buf);
-			if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error TSRMLS_CC)) {
+			if (FAILURE == phar_verify_signature(fp, php_stream_tell(fp) - size - 512, myphar->sig_flags, buf + 8, size - 8, fname, &myphar->signature, &myphar->sig_len, error TSRMLS_CC)) {
 				if (error) {
 					char *save = *error;
 					spprintf(error, 4096, "phar error: tar-based phar \"%s\" signature cannot be verified: %s", fname, save);

Modified: php/php-src/trunk/ext/phar/tests/badparameters.phpt
===================================================================
--- php/php-src/trunk/ext/phar/tests/badparameters.phpt	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/trunk/ext/phar/tests/badparameters.phpt	2009-07-24 17:07:05 UTC (rev 284712)
@@ -76,11 +76,6 @@
 } catch (Exception $e) {
 echo $e->getMessage() . "\n";
 }
-try {
-$c->setSignatureAlgorithm(Phar::MD5);
-} catch (Exception $e) {
-echo $e->getMessage() . "\n";
-}
 $a->compress(array());
 try {
 $a->compress(1);
@@ -160,7 +155,6 @@
 Warning: Phar::setDefaultStub() expects parameter 1 to be %string, array given in %sbadparameters.php on line %d
 Cannot change stub: phar.readonly=1
 Cannot set signature algorithm, phar is read-only
-Cannot set signature algorithm, not possible with zip-based phar archives

 Warning: Phar::compress() expects parameter 1 to be long, array given in %sbadparameters.php on line %d
 Cannot compress phar archive, phar is read-only

Modified: php/php-src/trunk/ext/phar/util.c
===================================================================
--- php/php-src/trunk/ext/phar/util.c	2009-07-24 16:50:06 UTC (rev 284711)
+++ php/php-src/trunk/ext/phar/util.c	2009-07-24 17:07:05 UTC (rev 284712)
@@ -21,6 +21,9 @@
 /* $Id$ */

 #include "phar_internal.h"
+#ifdef PHAR_HASH_OK
+#include "ext/hash/php_hash_sha.h"
+#endif

 #ifdef PHAR_HAVE_OPENSSL
 /* OpenSSL includes */
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to