]> granicus.if.org Git - php/commitdiff
finish code coverage testing of phar_object.c (except for iterator building, which...
authorGreg Beaver <cellog@php.net>
Fri, 25 Apr 2008 16:10:59 +0000 (16:10 +0000)
committerGreg Beaver <cellog@php.net>
Fri, 25 Apr 2008 16:10:59 +0000 (16:10 +0000)
ext/phar/tests/phar_oo_getcontents.phpt
ext/phar/util.c

index 76b3e647133d5e67b0280e637e9aae0956704933..e42bca46fcf783326b7619d26637d3d6657c3596 100644 (file)
@@ -10,9 +10,20 @@ phar.readonly=0
 $fname = dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
 
 $phar = new Phar($fname);
-$phar['a'] = 'file contents
+$phar['a/b'] = 'file contents
 this works';
-echo $phar['a']->getContent() . "\n";
+$phar->addEmptyDir('hi');
+echo $phar['a/b']->getContent() . "\n";
+try {
+echo $phar['a']->getContent(), "\n";
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
+try {
+echo $phar['hi']->getContent(), "\n";
+} catch (Exception $e) {
+echo $e->getMessage(), "\n";
+}
 ?>
 ===DONE===
 --CLEAN--
@@ -20,7 +31,9 @@ echo $phar['a']->getContent() . "\n";
 unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php');
 __halt_compiler();
 ?>
---EXPECT--
+--EXPECTF--
 file contents
 this works
+Phar error: Cannot retrieve contents, "a" in phar "%sphar_oo_getcontents.phar.php" is a directory
+Phar error: Cannot retrieve contents, "hi" in phar "%sphar_oo_getcontents.phar.php" is a directory
 ===DONE===
\ No newline at end of file
index 16065b633913f6daef30d444103d4b5cdd9af982..82321a1c0b94896ab53375405221cd9ad34d35c9 100644 (file)
@@ -1228,6 +1228,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, in
                                entry->is_temp_dir = entry->is_dir = 1;
                                entry->filename = (char *) estrndup(path, path_len + 1);
                                entry->filename_len = path_len;
+                               entry->phar = phar;
                                return entry;
                        }
                }