[PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c /ext/zip/tests bug47667.phpt
mkoppanen Mon Mar 16 10:22:13 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/zip/tests bug47667.phpt Modified files: /php-src/ext/zip/libzip_open.c Log: Closes bug #47667 http://cvs.php.net/viewvc.cgi/php-src/ext/zip/lib/zip_open.c?r1=1.1.2.11&r2=1.1.2.12&diff_format=u Index: php-src/ext/zip/lib/zip_open.c diff -u php-src/ext/zip/lib/zip_open.c:1.1.2.11 php-src/ext/zip/lib/zip_open.c:1.1.2.12 --- php-src/ext/zip/lib/zip_open.c:1.1.2.11 Thu Jan 1 19:32:45 2009 +++ php-src/ext/zip/lib/zip_open.c Mon Mar 16 10:22:13 2009 @@ -65,6 +65,10 @@ struct zip_cdir *cdir; int i; off_t len; + +if (flags & ZIP_OVERWRITE) { + return _zip_allocate_new(fn, zep); +} switch (_zip_file_exists(fn, flags, zep)) { case -1: http://cvs.php.net/viewvc.cgi/php-src/ext/zip/tests/bug47667.phpt?view=markup&rev=1.1 Index: php-src/ext/zip/tests/bug47667.phpt +++ php-src/ext/zip/tests/bug47667.phpt --TEST-- Bug #47667 (ZipArchive::OVERWRITE seems to have no effect) --SKIPIF-- --FILE-- open($filename, ZipArchive::CREATE) !== true) { exit("Unable to open the zip file"); } else { $zip->addFromString('foo.txt', 'foo bar foobar'); $zip->close(); } for ($i = 0; $i < 10; $i++) { $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::OVERWRITE) !== true) { exit("Unable to open the zip file"); } $zip->addFromString("foo_{$i}.txt", 'foo bar foobar'); $zip->close(); } $zip = new ZipArchive(); if ($zip->open($filename, ZipArchive::CREATE) !== true) { exit("Unable to open the zip file"); } echo "files: " , $zip->numFiles; unlink($filename); --EXPECT-- files: 1 -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c
pajoye Thu Jan 1 19:32:45 2009 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/zip/libzip_open.c Log: - restore overwrite feature (regression introduced in 5.2.8) http://cvs.php.net/viewvc.cgi/php-src/ext/zip/lib/zip_open.c?r1=1.1.2.10&r2=1.1.2.11&diff_format=u Index: php-src/ext/zip/lib/zip_open.c diff -u php-src/ext/zip/lib/zip_open.c:1.1.2.10 php-src/ext/zip/lib/zip_open.c:1.1.2.11 --- php-src/ext/zip/lib/zip_open.c:1.1.2.10 Wed Dec 31 11:17:47 2008 +++ php-src/ext/zip/lib/zip_open.c Thu Jan 1 19:32:45 2009 @@ -68,7 +68,10 @@ switch (_zip_file_exists(fn, flags, zep)) { case -1: + if (!(flags & ZIP_OVERWRITE)) { return NULL; + } + case 0: return _zip_allocate_new(fn, zep); default: @@ -440,7 +443,7 @@ } if (stat(fn, &st) != 0) { - if (flags & ZIP_CREATE) + if (flags & ZIP_CREATE || flags & ZIP_OVERWRITE) return 0; else { set_error(zep, NULL, ZIP_ER_OPEN); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c
Oops, didn't see this. > -Original Message- > From: Pierre [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 15, 2006 9:41 AM > To: Dmitry Stogov > Cc: Pierre-Alain Joye; php-cvs@lists.php.net; Wez Furlong > Subject: Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c > > On 11/15/06, Dmitry Stogov <[EMAIL PROTECTED]> wrote: > > I am not sure in this patch, because it changes the whole > process behavior. > > May be you need add character "b" into 'mode' then you open > zip archive? > > Please check: > > http://news.php.net/php.internals/26606 > > Can we discuss the issue there? > > --Pierre > > -- > PHP CVS Mailing List (http://www.php.net/) To unsubscribe, > visit: http://www.php.net/unsub.php > -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c
Hi Pierre, I think that changing global behavior (_fmode = _O_BINARY;) is not a good idea. May be this code should be removed from CGI and CLI too. May be we have a bug somewhere and _O_BINARY is not passed to open(). Do you think the bug is in CRT? What VC version do you use? Dmitry. > -Original Message- > From: Pierre [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 15, 2006 8:41 PM > To: Dmitry Stogov > Cc: Pierre-Alain Joye; php-cvs@lists.php.net; Wez Furlong > Subject: Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c > > > On 11/15/06, Dmitry Stogov <[EMAIL PROTECTED]> wrote: > > I am not sure in this patch, because it changes the whole process > > behavior. May be you need add character "b" into 'mode' > then you open > > zip archive? > > Please check: > > http://news.php.net/php.internals/26606 > > Can we discuss the issue there? > > --Pierre > -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c
On 11/15/06, Dmitry Stogov <[EMAIL PROTECTED]> wrote: I am not sure in this patch, because it changes the whole process behavior. May be you need add character "b" into 'mode' then you open zip archive? Please check: http://news.php.net/php.internals/26606 Can we discuss the issue there? --Pierre -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c
I am not sure in this patch, because it changes the whole process behavior. May be you need add character "b" into 'mode' then you open zip archive? Dmitry. > -Original Message- > From: Pierre-Alain Joye [mailto:[EMAIL PROTECTED] > Sent: Wednesday, November 15, 2006 7:24 PM > To: php-cvs@lists.php.net > Subject: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c > > > pajoyeWed Nov 15 16:24:24 2006 UTC > > Modified files: (Branch: PHP_5_2) > /php-src/ext/zip/lib zip_open.c > Log: > #39506 and PECL #9278, should fix the problem for the other > SAPI (works for CLI, CGI and embed) > see: http://news.php.net/php.internals/26606 for the details > > http://cvs.php.net/viewvc.cgi/php-src/ext/zip/lib/zip_open.c?r 1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/zip/lib/zip_open.c diff -u php-src/ext/zip/lib/zip_open.c:1.1.2.1 php-src/ext/zip/lib/zip_open.c:1.1.2.2 --- php-src/ext/zip/lib/zip_open.c:1.1.2.1 Sun Aug 13 21:09:59 2006 +++ php-src/ext/zip/lib/zip_open.c Wed Nov 15 16:24:24 2006 @@ -75,6 +75,10 @@ return NULL; } +#ifdef PHP_WIN32 + _fmode = _O_BINARY; +#endif + if (flags & ZIP_OVERWRITE || stat(fn, &st) != 0) { if ((flags & ZIP_CREATE) || (flags & ZIP_OVERWRITE)) { if ((za=_zip_new(&error)) == NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src(PHP_5_2) /ext/zip/lib zip_open.c
pajoye Wed Nov 15 16:24:24 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/zip/libzip_open.c Log: #39506 and PECL #9278, should fix the problem for the other SAPI (works for CLI, CGI and embed) see: http://news.php.net/php.internals/26606 for the details http://cvs.php.net/viewvc.cgi/php-src/ext/zip/lib/zip_open.c?r1=1.1.2.1&r2=1.1.2.2&diff_format=u Index: php-src/ext/zip/lib/zip_open.c diff -u php-src/ext/zip/lib/zip_open.c:1.1.2.1 php-src/ext/zip/lib/zip_open.c:1.1.2.2 --- php-src/ext/zip/lib/zip_open.c:1.1.2.1 Sun Aug 13 21:09:59 2006 +++ php-src/ext/zip/lib/zip_open.c Wed Nov 15 16:24:24 2006 @@ -75,6 +75,10 @@ return NULL; } +#ifdef PHP_WIN32 + _fmode = _O_BINARY; +#endif + if (flags & ZIP_OVERWRITE || stat(fn, &st) != 0) { if ((flags & ZIP_CREATE) || (flags & ZIP_OVERWRITE)) { if ((za=_zip_new(&error)) == NULL) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php