cellog          Tue May 20 03:56:35 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/phar   phar_object.c 
  Log:
  relax conversion, so that if a phar has no files, we can convert it to 
another format without changing the extension
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/phar_object.c?r1=1.266.2.6&r2=1.266.2.7&diff_format=u
Index: php-src/ext/phar/phar_object.c
diff -u php-src/ext/phar/phar_object.c:1.266.2.6 
php-src/ext/phar/phar_object.c:1.266.2.7
--- php-src/ext/phar/phar_object.c:1.266.2.6    Sun May 18 23:41:08 2008
+++ php-src/ext/phar/phar_object.c      Tue May 20 03:56:35 2008
@@ -17,7 +17,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: phar_object.c,v 1.266.2.6 2008/05/18 23:41:08 cellog Exp $ */
+/* $Id: phar_object.c,v 1.266.2.7 2008/05/20 03:56:35 cellog Exp $ */
 
 #include "phar_internal.h"
 #include "func_interceptors.h"
@@ -1819,6 +1819,7 @@
        char *error;
        const char *pcr_error;
        int ext_len = ext ? strlen(ext) : 0;
+       phar_archive_data **pphar;
 
        if (!ext) {
                if (phar->is_zip) {
@@ -1889,12 +1890,18 @@
        efree(basepath);
        efree(newname);
 
-       if (zend_hash_exists(&(PHAR_GLOBALS->phar_fname_map), newpath, 
phar->fname_len)) {
+       if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), newpath, 
phar->fname_len, (void **) &pphar)) {
+               if (*pphar == phar) {
+                       if (!zend_hash_num_elements(&phar->manifest)) {
+                               goto its_ok;
+                       }
+               }
                efree(oldpath);
                zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 
TSRMLS_CC, "Unable to add newly converted phar \"%s\" to the list of phars, a 
phar with that name already exists", phar->fname);
                return NULL;
        }
 
+its_ok:
        if (!phar->is_data) {
                if (SUCCESS != phar_detect_phar_fname_ext(newpath, 
phar->fname_len, (const char **) &(phar->ext), &(phar->ext_len), 1, 1, 1 
TSRMLS_CC)) {
                        efree(oldpath);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to