Dmitry Stogov wrote:
dmitry Thu Jul 10 14:27:21 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/phar/tests rename_dir.phpt rmdir.phpt
/php-src/ext/phar/tests/tar rename_dir.phpt rmdir.phpt
/php-src/ext/phar/tests/zip rename_dir.phpt rmdir.phpt
Log:
Added tests that demonstrate serious PHAR errors
They cannot be easly fixed without algorithms modification
Hi Dmitry,
These tests all demonstrate modification of virtual directories, i.e.
directories that are not really in the archive as entries, but simply
are part of a path of existing files. However, I think we can easily
add support for this by adding an iteration loop at the end of
phar_wrapper_rename and phar_wrapper_rmdir implementations that cycles
over all of the files and renames their directories. It would be slow,
but truth be told, this is only going to be done on phar construction
anyways, so performance is not a huge issue there.
There is a similar loop that can be cut/pasted from phar_make_dirstream
in phar/dirstream.c that scans all files to find matches that are in the
requested directory. With slight modification to the loop the tests
will pass (i.e. instead of adding the file to the opendir hash, perform
the rename of the directory portion of the filename using a clever
spprintf and a few temporary null bytes at directory separator
boundaries in the original file, then zend_hash_add a new entry and
either remove the old one or mark it deleted if it has open refcounts).
The rmdir implementation should simply fail if any file or directory
exists in the virtual directory.
If no one fixes this by August 13 or so, I will try my hand at it.
Greg
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php