diff options
| author | Greg Beaver <cellog@php.net> | 2008-05-11 22:59:16 +0000 |
|---|---|---|
| committer | Greg Beaver <cellog@php.net> | 2008-05-11 22:59:16 +0000 |
| commit | 70d0a4c0456f4c53856e28963dd2275385589454 (patch) | |
| tree | 28fe0ccb6f502d2ef5601a5568fb505a0fef6561 | |
| parent | ad1be25d8c047fca31df6ffddbe9b904894ecf17 (diff) | |
| download | php-git-70d0a4c0456f4c53856e28963dd2275385589454.tar.gz | |
increase code coverage and fix tiny bug in handling of absolute links
| -rw-r--r-- | ext/phar/tests/tar/files/biglink.tar | bin | 0 -> 10240 bytes | |||
| -rw-r--r-- | ext/phar/tests/tar/links3.phpt | 19 | ||||
| -rw-r--r-- | ext/phar/util.c | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/ext/phar/tests/tar/files/biglink.tar b/ext/phar/tests/tar/files/biglink.tar Binary files differnew file mode 100644 index 0000000000..43bbf58423 --- /dev/null +++ b/ext/phar/tests/tar/files/biglink.tar diff --git a/ext/phar/tests/tar/links3.phpt b/ext/phar/tests/tar/links3.phpt new file mode 100644 index 0000000000..2241081660 --- /dev/null +++ b/ext/phar/tests/tar/links3.phpt @@ -0,0 +1,19 @@ +--TEST-- +Phar: tar with link to absolute path +--SKIPIF-- +<?php if (!extension_loaded("phar")) die("skip"); ?> +--FILE-- +<?php +try { + $p = new PharData(dirname(__FILE__) . '/files/biglink.tar'); +} catch (Exception $e) { + echo $e->getMessage() . "\n"; +} +echo $p['file.txt']->getContent(); +echo $p['my/file']->getContent(); +?> +===DONE=== +--EXPECT-- +my file +my file +===DONE=== diff --git a/ext/phar/util.c b/ext/phar/util.c index ddd51eb6fe..09258b1f96 100644 --- a/ext/phar/util.c +++ b/ext/phar/util.c @@ -33,7 +33,7 @@ static char *phar_get_link_location(phar_entry_info *entry TSRMLS_DC) return NULL; } if (entry->link[0] == '/') { - return entry->link; + return estrdup(entry->link + 1); } tmp = estrndup(entry->filename, entry->filename_len); p = strrchr(tmp, '/'); |
